Reputation: 3
I have encountered a problem where my C# code used to write lines to a text file writes more than one line of one type. For instance, I want it to save test3, 100 to a text file containing:
test1, 10
test2, 75
instead of getting
test1, 10
test2, 75
test3, 100
I get:
test1, 10
test2, 75
test3, 100
test3, 100
and so for more than 100 more lines.
Upvotes: 0
Views: 347
Reputation: 4826
It would appear that you're likely entering the else if (pacManLives == 0)
block multiple times. This is adding duplicate listeners, thereby calling your save method more than once later on.
You should probably be adding your listeners in some initialization code that gets called one time only.
Upvotes: 1