Click here to Skip to main content
15,899,314 members
Home / Discussions / C#
   

C#

 
QuestionHow to avoid stack overflow ? Pin
Spunky Coder21-Jan-09 22:13
Spunky Coder21-Jan-09 22:13 
AnswerRe: How to avoid stack overflow ? Pin
Pete O'Hanlon21-Jan-09 22:40
mvePete O'Hanlon21-Jan-09 22:40 
AnswerRe: How to avoid stack overflow ? Pin
#realJSOP22-Jan-09 0:14
professional#realJSOP22-Jan-09 0:14 
GeneralRe: How to avoid stack overflow ? Pin
S. Senthil Kumar22-Jan-09 3:05
S. Senthil Kumar22-Jan-09 3:05 
AnswerRe: How to avoid stack overflow ? Pin
Guffa22-Jan-09 0:35
Guffa22-Jan-09 0:35 
GeneralRe: How to avoid stack overflow ? Pin
Spunky Coder26-Jan-09 22:34
Spunky Coder26-Jan-09 22:34 
GeneralRe: How to avoid stack overflow ? Pin
Guffa27-Jan-09 1:22
Guffa27-Jan-09 1:22 
AnswerRe: How to avoid stack overflow ? Pin
Ben Fair22-Jan-09 4:43
Ben Fair22-Jan-09 4:43 
There is probably something going wrong in the recursion as the nesting should not really get that deep. When the exception occurs take a second to look at the stack trace in the debugger and get an idea of how deep the recursion got. However, to answer your question the alternate of recursion is to use and manage a Stack yourself. Using the Generic Collections from .NET 2.0, you can use Stack<T> for this purpose. It's really the same concept as recursion because in recursion you're using the call stack and the system is managing it for you. Anyhow, there are bunches of good articles on the internet of how to mimic recursion with a stack; off-hand I found this one:

http://haacked.com/archive/2007/03/04/Replacing_Recursion_With_a_Stack.aspx[^]

Hope that helps!

Keep It Simple Stupid! (KISS)

GeneralRe: How to avoid stack overflow ? Pin
Spunky Coder26-Jan-09 23:05
Spunky Coder26-Jan-09 23:05 
GeneralRe: How to avoid stack overflow ? Pin
Guffa27-Jan-09 1:27
Guffa27-Jan-09 1:27 
GeneralRe: How to avoid stack overflow ? Pin
Ben Fair27-Jan-09 4:11
Ben Fair27-Jan-09 4:11 
QuestionSave Listview data to SQL database Pin
Tuntgerhuu21-Jan-09 22:06
Tuntgerhuu21-Jan-09 22:06 
AnswerRe: Save Listview data to SQL database Pin
CPallini21-Jan-09 23:22
mveCPallini21-Jan-09 23:22 
QuestionWCF Client is not Receving Response Pin
Member 587250021-Jan-09 21:54
Member 587250021-Jan-09 21:54 
QuestionTest string for DBnull as opposed to null? Pin
kanchoette21-Jan-09 21:32
kanchoette21-Jan-09 21:32 
AnswerRe: Test string for DBnull as opposed to null? Pin
SeMartens21-Jan-09 21:34
SeMartens21-Jan-09 21:34 
GeneralRe: Test string for DBnull as opposed to null? Pin
SeMartens21-Jan-09 21:36
SeMartens21-Jan-09 21:36 
QuestionHow to Convert Data from Tiff file to Text Format in C# Pin
ChandrakanthGaddam21-Jan-09 21:25
ChandrakanthGaddam21-Jan-09 21:25 
AnswerRe: How to Convert Data from Tiff file to Text Format in C# Pin
SeMartens21-Jan-09 21:29
SeMartens21-Jan-09 21:29 
QuestionWhat means @ before string in C#? Pin
xx77abs21-Jan-09 21:22
xx77abs21-Jan-09 21:22 
AnswerRe: What means @ before string in C#? Pin
DaveyM6921-Jan-09 21:28
professionalDaveyM6921-Jan-09 21:28 
GeneralRe: What means @ before string in C#? Pin
xx77abs21-Jan-09 21:46
xx77abs21-Jan-09 21:46 
QuestionHow to get rid of event code Pin
Member 88441121-Jan-09 20:40
Member 88441121-Jan-09 20:40 
AnswerRe: How to get rid of event code Pin
Mycroft Holmes21-Jan-09 20:44
professionalMycroft Holmes21-Jan-09 20:44 
GeneralRe: How to get rid of event code [modified] Pin
Member 88441121-Jan-09 23:49
Member 88441121-Jan-09 23:49 

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.