Posts

Showing posts with the label C# Software Language

Structures in C #

Structures in C# In C#, a structure (struct) is a value type that encapsulates data members and member methods. It's a user-defined data type that allows you to create custom data structures tailored to specific needs. Key Characteristics of Structures:  * Value Type: When you declare a variable of a struct type, the actual data is stored directly in the variable. This means that when you assign a struct to another variable, a copy of the data is created.  * No Inheritance: Structures cannot inherit from other structures or classes.  * Default Constructor: Structures have a default parameterless constructor that initializes all members to their default values.  * No Destructor: Structures don't have destructors. The garbage collector automatically reclaims memory used by structures when they are no longer needed. Declaring a Structure: struct Point {     public int X;     public int Y;     public void Display()     {   ...

C# Access Specifiers

PUBLIC: All the class members declared under public will be available to everyone PRIVATE: The class members declared as private can be accessed only by the functions inside the class PROTECTED: The class members declared as protected are inaccessible outside the class but they can be accessed by subclass of the class INTERNAL: The class members declared as internal are accessible by other functions and objects lying within the assembly. Assembly is the produced.dll or .exe from .NET Code PROTECTED INTERNAL: Memebers are accessible within the same assembly as well as inheritance. It is a combination or internal and protected Access Specifiers