Jump to content
Posted 27 October 2011 - 07:45 PM
Posted 27 October 2011 - 08:10 PM
Posted 27 October 2011 - 08:34 PM
Posted 27 October 2011 - 09:19 PM
I'll assume you're familiar with terminology such as method/function call, what a method/function is, and the concept of arguments.
I have gone through a million books, tutorials, videos, researched. And it's all still just giving me a headache.
I've read that alot of books/etc don't give a GOOD representation of what is actually happening. Meaning I am just reading junk that isn't entirely true.
As for what I seemingly don't understand, it's the whole concept of stack/heap. All I know is that its about memory management, that is it.
As for Reference Types, I was in the process of learning about this and then the whole stack/heap thing came into play and just confused the hell out of me.
I somewhat get that X is holding a reference to MyInt. It's just that the whole stack/heap thing has my head spinning.
System.Console.WriteLine("Hello World!"). Your stack still has the functions on it, but it also has a string on the stack - so at the bottom of the stack is the function Main, then the function System.Console.WriteLine, and at the very top, the string "Hello World!".
Posted 27 October 2011 - 10:20 PM
Posted 28 October 2011 - 02:29 AM
Posted 28 October 2011 - 07:44 AM
Posted 28 October 2011 - 10:45 AM
Posted 28 October 2011 - 11:25 AM
Posted 28 October 2011 - 12:08 PM
I think a source of much of the confusion is the stack in C++, where the programmer had much more implicit control. In C# to be honest, I don't really know why they even made the distinguishment. They should have probably ignored the concept completely and made it something only the compiler developers were really aware of. Worst case scenario, for those few edge cases where the developer needed to optimize for stack usage, it could have been exposed as an attribute. Actually, there is already the stackalloc method, so even this wouldn't be need.