Loading, please wait...

A to Z Full Forms and Acronyms

Briefly explain all .NET types

Jul 11, 2020 .NETtypes, 5951 Views
In this article you will learn about types of .NET

Briefly explain all .NET types

Types of .NET

Types in .NET mean the members of the following set: enumerations, classes, structures, interfaces, and delegates. All types can be categorized as value types or reference types.

Enumeration:-

An enumeration defines a set of named integers. Enumerations are extensively used in the .NET framework. Because integers are value types, enumerations are value types too.

Enums are a set of name/value pairs that always derives from the System. Enum. By default the storage used for a given enumeration is System.Int32, but you are able to specify a different storage type if you are concerned with saving every byte of memory.

The following additional restrictions apply to enumerations:

  • They cannot define their own methods

  • They cannot implement interfaces

  • They cannot define properties or events

  • They cannot define properties or events

  • They cannot be generic unless they are generic only because they are nested within a generic type. That is, an enumeration cannot have a type parameter of its own.

Classes:-

Classes are the most common type in the .NET framework. Usually one creates classes to be used in the application as a package of data and functionality. And strings and arrays are examples of .NET classes. All classes are reference types.

When you build custom classes you are building heap-allocated types that are managed by the .NET garbage collector. Class types benefit from each pillar of OOP, can work as base classes to other classes, and can define any number of members.

Structures:-

Structures, like classes, may include properties, methods, and even events and they are generally smaller and simpler than classes. Unlike classes, they are value types the most important difference between value types and reference types is the way that they are managed in the memory. Structures also lack some of the more advanced features of classes, such as inheritance and extension. All the intrinsic data types except the string data types (numerical, char, boolean, and date) are structures.

In essence, structures can be regarded as “lightweight class types” that are used to group logically related data items. Unlike classes, structures can not be subclasses. They always derive directly from System.ValueType. Structures are allowed on the stack rather than the heap and are therefore a bit more efficient than a corresponding class definition.

Delegates:-

Delegates are the foundation for event handling in .NET. The delegates are a function pointer that allows invoking a method indirectly.

Delegates are useful when one wishes to provide a way for one class to forward a call to another class asynchronously. Also, delegates have intrinsic support for forwarding a request to multiple recipients delegates are reference types.

Interfaces:-

Interfaces define contracts or protocols to which a class or structure must adhere. An interface is a named set of abstract members. The abstract members do not provide an implementation. Interfaces are an advanced technique of object-oriented programming and they are useful when standardizing how objects interact.

A to Z Full Forms and Acronyms

Related Article