C# Struct

C# Code Snippets C# Struct
Share:

About

In this code snippet, we’ll make a struct in C#. 

A struct is like a lightweight class. You would use a struct for making a small object that doesn’t have a lot of members. If your struct grows too big(has too many properties/methods) you should make a class instead.

Let’s see how to make a struct in the code below.

Note

One struct can’t inherit from another struct.

Code:

Resulting output:

Share:

Leave a Reply

Your email address will not be published.

The following GDPR rules must be read and accepted:
This form collects your name, email and content so that we can keep track of the comments placed on the website. For more info check our privacy policy where you will get more info on where, how and why we store your data.

Advertisment ad adsense adlogger