What is the difference between a struct and a class in C#?

1 Answers

Ravi Vishwakarma
Ravi Vishwakarma

Class and struct are both user-defined data types, but have some major differences.


  1. The struct is a value type in C# and it inherits from System.Value Type.
  2. Struct is usually used for smaller amounts of data.
  3. Struct can’t be inherited from other types.
  4. A structure can't be abstract.
  5. No need to create an object with a new keyword.
  6. Do not have permission to create any default constructor.


  1. The class is a reference type in C# and it inherits from the System.Object Type.
  2. Classes are usually used for large amounts of data.
  3. Classes can be inherited from other classes.
  4. A class can be an abstract type.
  5. We can create a default constructor.