Enums in C#

Share this…Facebook0TwitterLinkedinPrint Post Views: 408 Enums in C#:- An enum type is a distinct value type with a set of named constants. The following example declares and uses an enum type named Color with three constant values, Red, Green, and Blue. using System; enum Color { Red, Green, Blue } class Test { static void […]

Interface in C#

Share this…Facebook0TwitterLinkedinPrint Post Views: 451 Interface in C#: An interface defines a contract that can be implemented by classes and structs. An interface can contain methods, properties, events, and indexers. An interface does not provide implementations of the members it defines—it merely specifies the members that must be supplied by classes or structs that implement […]

Arrays in C#

Share this…Facebook0TwitterLinkedinPrint Post Views: 328 An array is a data structure that contains a number of variables that are accessed through computed indices. The variables contained in an array, also called the elements of the array, are all of the same type, and this type is called the element type of the array. Array types […]

Struct in C#

Share this…Facebook0TwitterLinkedinPrint Post Views: 403 Like classes, structs are data structures that can contain data members and function members, but unlike classes, structs are value types and do not require heap allocation. A variable of a struct type directly stores the data of the struct, whereas a variable of a class type stores a reference […]

Constructors and Destructor in C-SHARP

Share this…Facebook0TwitterLinkedinPrint Post Views: 293 Constructors C# supports both instance and static constructors. An instance constructor is a member that implements the actions required to initialize an instance of a class. A static constructor is a member that implements the actions required to initialize a class itself when it is first loaded. A constructor is […]