A struct type is a value type thatis typically used to encapsulate small groups of related variables, suchas details of student.
/// ID of student
public string StudentID;
/// Name of student
public string Name;
/// Father’s name of student
public string FatherName;
/// Address of student
public string Address;
Example: Using struct
To use a struct,instantiate the struct and use it just like a class.
StudentDetails sd = new StudentDetails;
sd.Address= "California, USA";
Difference between struct and class
Structs may seem similar to classes, but there areimportant differences that you should be aware of. First of all, classes arereference types and structs are value types. By using structs, you can createobjects that behave like the built-in types and enjoy their benefits as well.