#205 – Five Kinds of Types That Are User-Definable

C# allows you to create new types.  There are five kinds of types that you can define.

A class is a data structure containing data and its associated behavior.  You can create an instance of a class using the new keyword, giving you an object.

A struct is similar to a class, containing data and behavior.  But an instance of a struct is created on the stack, rather than the heap.

An interface defines a set of methods, properties and events that a class can implement.  It is just a description of what a class needs to implement, in order to fully implement the interface.

A delegate is a definition of a method signature, which includes the data type of the method’s parameters and return value.  An instance of a delegate type references a specific method.

An enum type represents a set of named constants.

About Sean
Software developer in the Twin Cities area, passionate about .NET technologies. Equally passionate about my own personal projects related to family history and preservation of family stories and photos.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 43 other followers