Structure in C# with Example

Structure in C# with Example
Rating: 5 - 1 Votes

Structure in C# with Example

Structure in C# with Example

Structure in C# with Example

In C#, structure is very useful if you want to store some custom data.  Like a Class in C#, a structure can also have fields, methods, properties, and constructors.  Structure is pretty much similar to a class, but there are some differences between a structure and a class.  Structure is of value type and class is of reference type.  A very common example of structure is System.Int32 known by alias int and System.Double known by alias double, both of them are of value type.  To create structure, we use struct keyword followed by structure name.

 Output:

Roberto Carlos
Press any key to continue . . .