---
title: "What is the difference between a struct and a class in C#?"  
description: "What is the difference between a struct and a class in C#?"  
author: "Jivika Rai"  
published: 2017-12-18  
canonical: https://answers.mindstick.com/qa/31819/what-is-the-difference-between-a-struct-and-a-class-in-c-sharp  
category: "technology"  
tags: ["c#"]  
reading_time: 2 minutes  

---

#  What is the difference between a struct and a class in C#?

What is the [difference](https://www.mindstick.com/blog/398/difference-between-object-type-and-var-type) between a [struct](https://www.mindstick.com/blog/83/struct-in-c-sharp-dot-net) and a [class](https://www.mindstick.com/articles/12089/arrays-in-java-determining-class-of-an-array-part-8) in C#?

## Answers

### Answer by Hemant Patel

**Difference between Struct and Class:** The main difference between **Struct** and **Class** is, **Struct** is value type but the **Class** is referenced type. So **Struct** store in the ***stack***, but **Class** object store in ***heap***. The Detailed difference between **Struct** and **Class** are as follows:\

| **Struct** \ | **Class** |
| --- | --- |
| The Struct is usually used for the smaller amount of data. | Class is used for a large amount of data. |
| The Struct cannot be inherited to other types. | The Class can inherit the interfaces, abstract classes. |
| A struct does not have permission to create any default constructor. | Class will have the default constructor. |
| The struct is the value type and it inherits from System.ValueType. | But the Class in C# is a reference type and it inherits from the System.Object Type. |
| Its no need to create an object by new keyword. | We can’t use an object of a class with using the new keyword. |
| The struct can have a constructor. | But the Class can have Constructor and Destructor. |
| The Struct can’t contain a volatile field. | The Class contains a volatile field. |
| Struct variable can’t be initialized with a null value. \ \ | But you can be initialized Class variable with a Null value. |

\


---

Original Source: https://answers.mindstick.com/qa/31819/what-is-the-difference-between-a-struct-and-a-class-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
