Heinrich,

I still don't understand in plain vanilla business app i.e. GUI (
WinForm/WPF/Asp.net ) + Domain/BLL + Repository/DLL etc, where would using
structs be beneficial.
Of course a simple example using Classes vs Structs just to compare the
pros and cons would be great but where in business apps that
becomes relevant?

Regards

Arjang


On 22 August 2012 20:50, Les Hughes <l...@datarev.com.au> wrote:

> Heinrich Breedt wrote:
>
>> http://msdn.microsoft.com/en-**us/library/ms229017.aspx<http://msdn.microsoft.com/en-us/library/ms229017.aspx>
>> --
>> Heinrich Breedt
>>
>> “Do not wait to strike till the iron is hot; but make it hot by
>> striking.” - William B. Sprague
>>
>
> That post just touches on the pros/cons of storing data in the heap/stack
> with a brief mention in linking immutable objects. It doesn't mean putting
> things on the stack is automatically a bad idea. In the example I gave in
> my last post, I would be putting 96bytes on instead of 32 for a reference
> type, and it would mean those 96bytes would be duplicated when the function
> returns.
>
> Nothing to really worry about there, whereas if you had a struct with a
> few thousand primitive types/references which is run numerous times, then
> you might want to worry.
>
> The link also says that generally value types are cheaper than reference
> types, and also mentions structs are good for short-lived data. I'd say
> that the example I provided is a good candidate for when to use a struct.
>
> Anyone disagree?
> --
> Les Hughes
> l...@datarev.com.au
>
>
>

Reply via email to