Click here to Skip to main content
15,902,198 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to get last day of specific date Pin
Maciej Los23-Sep-18 22:02
mveMaciej Los23-Sep-18 22:02 
GeneralRe: How to get last day of specific date Pin
OriginalGriff23-Sep-18 22:26
mveOriginalGriff23-Sep-18 22:26 
AnswerRe: How to get last day of specific date Pin
OriginalGriff23-Sep-18 21:38
mveOriginalGriff23-Sep-18 21:38 
AnswerRe: How to get last day of specific date Pin
Richard MacCutchan23-Sep-18 21:54
mveRichard MacCutchan23-Sep-18 21:54 
QuestionStackoverflow Pin
Thomas Kiær23-Sep-18 0:28
Thomas Kiær23-Sep-18 0:28 
AnswerRe: Stackoverflow Pin
OriginalGriff23-Sep-18 1:13
mveOriginalGriff23-Sep-18 1:13 
GeneralRe: Stackoverflow Pin
Thomas Kiær23-Sep-18 5:45
Thomas Kiær23-Sep-18 5:45 
GeneralRe: Stackoverflow Pin
OriginalGriff23-Sep-18 6:04
mveOriginalGriff23-Sep-18 6:04 
No, a pause won't make any difference.

This is going to be difficult to explain without being able to tell when your eyes glaze over, but I'll try.

Suppose you have a stack of coins and a piece of paper. Each time you turn the paper over, you do exactly what it says.
So you turn the paper and it says:
1) Put a coin on the stack.
2) Turn over the paper.
So you do.
The stack grows one bigger, and you turn the paper. This time it says:
1) Put a coin on the stack.
2) Turn over the paper.
So you do.
The stack grows one bigger, and you turn the paper. You know what it says, because you are back where you started!
Each time you turn the paper, the stack of coins gets bigger, and bigger.
At some point, it reaches the ceiling, and you can't add another - but you try to force a coin on, and the whole pile falls to the ground with a crash!

That's what happens with unbounded recursive methods - you keep on calling it, and the stack gets bigger, and bigger until it runs out of space and your application crashes.
Adding a delay doesn't "fix the problem", it just means it takes longer in real-world time to get there, just as it does with the pile of coins. Even if you change one side of the paper to read
1) Put a coin on the stack.
2) Wait 30 seconds.
3) Turn over the paper.
The same problem will happen, the stack will still collapse, but it's happen later on in the day.

The way to fix this is: either get rid of the recursion, or add a boundary condition which lets you out of the method without the recursive call. There really is no other solution!
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!

GeneralRe: Stackoverflow Pin
Thomas Kiær23-Sep-18 6:14
Thomas Kiær23-Sep-18 6:14 
GeneralRe: Stackoverflow Pin
OriginalGriff23-Sep-18 6:27
mveOriginalGriff23-Sep-18 6:27 
QuestionC# Post files through rest api error Pin
Pradeep Kumar21-Sep-18 13:07
Pradeep Kumar21-Sep-18 13:07 
AnswerRe: C# Post files through rest api error Pin
Richard MacCutchan21-Sep-18 21:37
mveRichard MacCutchan21-Sep-18 21:37 
Questionstore image in DB by Parameters.AddWithValue Pin
Member 1352250120-Sep-18 17:01
Member 1352250120-Sep-18 17:01 
AnswerRe: store image in DB by Parameters.AddWithValue Pin
OriginalGriff20-Sep-18 21:23
mveOriginalGriff20-Sep-18 21:23 
QuestionHow to modify picturebox image when clicked button Pin
mores.JR20-Sep-18 9:54
mores.JR20-Sep-18 9:54 
QuestionMessage Removed Pin
20-Sep-18 9:07
Member 1399203720-Sep-18 9:07 
Questioncommunication between two child forms in C# Pin
Member 1332584619-Sep-18 13:10
Member 1332584619-Sep-18 13:10 
AnswerRe: communication between two child forms in C# Pin
OriginalGriff19-Sep-18 19:56
mveOriginalGriff19-Sep-18 19:56 
GeneralRe: communication between two child forms in C# Pin
Member 1332584621-Sep-18 9:07
Member 1332584621-Sep-18 9:07 
GeneralRe: communication between two child forms in C# Pin
OriginalGriff21-Sep-18 23:57
mveOriginalGriff21-Sep-18 23:57 
GeneralRe: communication between two child forms in C# Pin
Member 1332584622-Sep-18 10:44
Member 1332584622-Sep-18 10:44 
GeneralRe: communication between two child forms in C# Pin
OriginalGriff22-Sep-18 21:07
mveOriginalGriff22-Sep-18 21:07 
GeneralRe: communication between two child forms in C# Pin
Member 1332584623-Sep-18 7:26
Member 1332584623-Sep-18 7:26 
GeneralRe: communication between two child forms in C# Pin
OriginalGriff23-Sep-18 7:36
mveOriginalGriff23-Sep-18 7:36 
GeneralRe: communication between two child forms in C# Pin
Member 1332584625-Sep-18 10:13
Member 1332584625-Sep-18 10:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.