Count Files from Folder in C#

Hi Programmers, welcome to new post of c#.net. this article i’ll write the programs to count total files from folder using TopDirectoryOnly and AllDirectories enumerations.we can achieve the output using DirectoryInfo class and inside DirectoryInfo we should give Folder path. next we should use FileInfo class d objects calls GetFiles method. star(*) to search all […]

Byte Struct and SByte Struct in C#

Byte Struct represents an 8-bit unsigned integer. Its compact and efficient type. the minimum value of byte struct is 0 and maximum value of byte struct 255. so anything between the range will not give any error. see below image. SByte Struct represents an 8-bit unsigned integer. Its compact and efficient type. the minimum value […]

Nullable Types in C# Explained with Four Examples

Hi Programmers, welcome to new article of c#.net. This article i’ll explain the codes for nullable value type in c#.the question ( ?) operator is a shorthand syntax for nullable types. Let’s see important Examples. 1.we cannot be assigned a null value with any data type variable. For example, int i = null will give […]

Tuples In C# Explain with Two Examples

The Tuple is used to store immutable or unchangeable object data.A tuple has multiple fields of different data types. the Tuple return more than one values from class method. HereItem1 – Get the value of the current Tuple object’s first component. Item2 – Get the value of the current Tuple object’s second component. 1.Example to […]

Static Constructor Vs Instance Constructor in C#

Static Constructor : Static Constructor is used to initialize static variables. In Static constructor ,parameters are not allowed. No access modifier allowed in static constructor. The Object of static constructor cant be created. so we can call data members with class name. Static Constructor runs only one time in life cycle of class. we cant […]

Constructors in C# Explain with Five Examples

Hi Programmers, welcome to new article of ozanecare. This article i’ll write the program to explain Constructor in C#.A Constructor is a method that will run when you instantiate the class. Instantiate class means create an object / create specific class or executable files. If class doesn’t contain any constructor , the compiler create default […]

Null Coalescing Operator in C# Explain with Two Examples

Hi Programmers, welcome to new article of ozanecare. This article i’ll write the program to explain Null Coalescing Operator in C#. The ?? operator is called the null-coalescing operator. It returns the left-hand operand if the operand is not null else it returns the right hand operand. This is generally used to find or handle […]

Base Keyword in C# Explain with Three Examples

Hi Programmers, welcome to new article of ozanecare. This article i’ll write the program to explain base keyword in c#. The base keyword is used to access member of base class with derived class. A base class access is permitted only in constructor,an instance method,instance of the derived class.The Example of base keyword and flow […]

New Keyword in C# Explained with Three Examples

Hi Programmers, welcome to new article of ozanecare. This article i’ll write the program to explain new keyword in c#. The new keyword modifier explicitly hide a member inherited from a base class. Hiding inherited members means derived version of members replaces the base version. Hiding members without using new modifier allowed but generate warning. […]

Abstract Class and Abstract Method in C#

A class or method that contain abstract keyword is called Abstract class or Abstract method. An abstract class is an incomplete class and Abstract method cannot declare a body because it is marked abstract. we should use abstract class as base class so that derived class implements abstract members. Let’s see all important examples of […]