What are the differences between Class and Struct in C#?

1 Answers

Rahul Roi
Rahul Roi

Differences between Class and Struct in C#

Class
Struct
Supports Inheritance
Does not support Inheritance
Class is Pass by reference (reference type)
The struct is Pass by Copy (Value type)
Members are private by default
Members are public by default
Good for larger complex objects
Good for Small isolated models
Can use waste collector for memory management
Cannot use Garbage collector and hence no Memory management

Answer