Wednesday, December 12, 2012

Difference Between Value Types and Reference Types ,Class and Structure




Value Types
Reference Types
Value types include simple types like char, int, and float, enum types, and struct types
Reference types include class types, interface types, delegate types, and array types
Variable holds the actual value
Variable holds memory location
Allocated on stack
Allocated on heap
Assignment of one value type to
another copies the value
Assignment of one reference type to another copies the reference

class
structure
A class is inheritable from other existing classes.
A structure is not inheritable.

A class can have instance constructors
with or without parameters.
A structure can have instance
constructors only if they take
parameters.
A class is a reference type.
A structure A class is a reference type. is a value type.

No comments:

Post a Comment