By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,178 Members | 1,321 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,178 IT Pros & Developers. It's quick & easy.

Why use a Struct instead of a Class

P: n/a
I've used both Struct and Classes. However, after reading a few articles
lately, I'm starting to wonder why you would really use a Struct over a

The only reason seems to be that Structs are Valuetypes, and can perform
better with smaller data types (ie < 16 bytes). But in the kind of apps I
write, this is very rarely a consideration, and therefore I prefer to use
classes all the time.

Am I alone in this??

Mar 27 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a
No, most of the time, you should use a class. Structs are for very
specialized needs when you *want* value-type semantics. For the most
part, reference-type semantics are better.

Mar 27 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.