Skip to main content

Posts

Showing posts with the label C# Cheat Sheet

C# Cheat Sheet : Part 1

Constructors Constructors are used to Initialize the objects, parameters when the object is getting initialized,  Constructors can be of type Public Private Protected  Internal Protected Internal Static  Public Constructors This type will be instantiated every time the new operator is used for the class or struct, Typically constructors will be without any parameters, For Example  Class Cls = new Class ();   but this will not be the case always, you can instantiate the class by practically  any number of arguments .  Private Constructors If the programmer doesn't want a particular class to be instantiated but wants the client code to use the class members then the programmer may set the constructor to be private Example Program: The following program generates the number of desired GUIDs, and the class initialization is freezed by private constructor     public class StringAppend     {         private StringAppend()