Boxed structs cannot be updated from C#. And it sounds like most of yours would be boxed, as a result of them being put on the heap. This means you'll end up creating new structs simply to update a single property, and this will result in more memory allocations and garbage collections.
As a rule of thumb, if you want to use memory on the stack then you should use a struct. Memory on the heap is best used through classes, since ... well ... that's what they're designed for. Cheers, John On Jun 17, 7:38 pm, epitka <[email protected]> wrote: > From the link you referenced (maybe I am not understanding > this) :"Now, Value Types are also sometimes placed on the Heap. > Remember the rule, Value Types always go where they were declared? > Well, if a Value Type is declared outside of a method, but inside a > Reference Type it will be placed within the Reference Type on the > Heap. > " > > But that is a different discussion, I am more interested in practical > consequences of using struct. Actually, I am trying to build a case > against it, as our architect seems to have particular love for them. > > On Jun 17, 12:45 pm, Fabio Maulo <[email protected]> wrote: > > > > > Google other reference...You scared me, really, I was going to throw some > > books out of the window. > > > 2009/6/17 Fabio Maulo <[email protected]> > > > >http://www.c-sharpcorner.com/UploadFile/rmcochran/csharp_memory011220... > > > > 2009/6/17 epitka <[email protected]> > > > >> Also, I don't think stack vs. heap is an issue here at all, since > > >> structure is declared as part of reference type so it will live on the > > >> heap, not on the stack. > > > >> On Jun 17, 11:36 am, Fabio Maulo <[email protected]> wrote: > > >> > stack instead heap ? > > > >> > 2009/6/17 epitka <[email protected]> > > > >> > > If one creates a structure instead of class to represent a > > >> > > "component", then it can be mapped using "Map" instead of > > >> > > "Component" (Fluent NHibernate) > > >> > > syntax. It works for reads but I wonder if there are any concerns as > > >> > > far as updates are concerned, or anything else that might cause > > >> > > problems? > > > >> > -- > > >> > Fabio Maulo > > > > -- > > > Fabio Maulo > > > -- > > Fabio Maulo- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
