1497

Array

Array :  An array is a fixed-size collection of the same type of elements. We know that variable can store single value but it does not support to store multiple values. So, C# introduced an array to overcome the problem. Array is a reference type and it uses a namespace System.Array. Array is a fixed-size […]

Read More
1963

How to replace multiple characters in a string?

There are various ways by which we can achieve string replacement in the current string. Let’s start a discussion on the different ways of replacement of multiple characters in a string. 1. String.Replace Method: The string.Replace method returns a new string in which all occurrences of a specified character or string in the current string are replaced […]

Read More
826

How to check a string is empty or null?

We always face a situation where we have to check whether the string is empty(non-null) or null. Most of the time we fail to check null or empty string as we consider them as same terms but actually, these both terms are different. Let’s see the different ways to check null or empty string. string industry=””; […]

Read More
1031

What is static class?

Static Class: A static class is a collection of unrelated methods like utility/helper classes. Hence, it is not related to the real-world object. you can not create an object of it. If the “Static” modifier is used to define a static class along with class name which makes class non-instantiable. If the static modifier is used […]

Read More
1025

What is partial classes and methods?

Partial classes: This feature enables you to split the definition of a class over multiple physical source files with a .cs extension. Each source file contains a section of the type or method definition, and all source files are combined as a single file when the application is compiled. The partial modifier can be applied to a […]

Read More
723

What is Const and Readonly?

Const and ReadOnly keyword are used as types of Constant. Const (read: constant) : Const is a compile-time constant and which field value must be assigned at the time of declaration. By default const is static, hence you can’t define its type as static. Only primitive or “built-in” C# Types (e.g. int, string, double, int, long, char, decimal, […]

Read More