Struct of Class

  • Thread starter Thread starter Simon Hart
  • Start date Start date
S

Simon Hart

Hi,

Is there any benefit in terms of performance to using a Struct over a class
to store objects?

Regards
Simon.
 
J. Verdrengh said:
From
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csre
f/html/vcrefstructtypes.asp:

Unless you need reference type semantics, a class that is smaller than 16
bytes may be more efficiently handled by the system as a struct.

In my experience, however, the desired semantics are a *much* bigger
issue than the efficiency. I rarely come across a case where I don't
mind what kind of semantics I use.
 
Back
Top