I am creating a service which will be consumed by presentation program. I am at a fork of defining my types as class or struct. Does .Net create 1 stack(to store value types) for each dll and exe or 1 stack per program. I am very sure it creates one Managed heap per program but not sure of stack. Please help me.
Thanks,
Omkar
Firstly The Stack Is An Implementation Detail.
As it happens there is 1 heap* per process and 1 stack per thread in a process, but you shouldn’t care about this and certainly shouldn’t use this when choosing between classes and structs.
See When to use struct in C#?
(*) Well, 1 managed heap anyway.