Chandu yadav has Published 1163 Articles

What is the HashSet, C# Set collection in C#?

Chandu yadav

Chandu yadav

Updated on 21-Jun-2020 15:46:43

177 Views

HashSet in C# eliminates duplicate strings or elements in an array.In C#, it is an optimized set collection.Let us see an example to remove duplicate strings using C# HashSet −Exampleusing System; using System.Collections.Generic; using System.Linq; class Program {    static void Main() {       string[] arr1 = ... Read More

Generics vs non-generics in C#

Chandu yadav

Chandu yadav

Updated on 21-Jun-2020 15:28:39

5K+ Views

There are two types of collections in C#: non-generic collections and generic collections.Generics in C#Generic collections hold elements of same datatypes.For example −ListDictionaryHashsetDictionary − Dictionary is a collection of keys and values in C#. Dictionary is included in the System.Collection.Generics namespace.Hashset − HashSet in C# eliminates duplicate strings or ... Read More

What is index-based I/O BitArray collection in C#?

Chandu yadav

Chandu yadav

Updated on 21-Jun-2020 15:21:05

108 Views

The BitArray class manages a compact array of bit values, which are represented as Booleans, where true indicates that the bit is on (1) and false indicates the bit is off (0).The following are the method of the index-based BitArray collection −Sr.No.Method & Description1public BitArray And(BitArray value);Performs the bitwise AND ... Read More

Generics in C#

Chandu yadav

Chandu yadav

Updated on 21-Jun-2020 14:43:04

297 Views

Generics allow you to write a class or method that can work with any data type.Write the specifications for the class or the method, with substitute parameters for data types. When the compiler encounters a constructor for the class or a function call for the method, it generates code to ... Read More

What is the System.Reflection.Module in C#?

Chandu yadav

Chandu yadav

Updated on 21-Jun-2020 14:18:33

205 Views

The System.Reflection namespace contains classes that allow you to obtain information about the application and to dynamically add types, values, and objects to the application.It has a module constructor that initializes a new instance of the Module class. A module is a portable executable file that has one or more ... Read More

How to define character constants in C#?

Chandu yadav

Chandu yadav

Updated on 21-Jun-2020 13:50:27

195 Views

Character literals are enclosed in single quotes. For example, 'x' and can be stored in a simple variable of char type. A character literal can be a plain character (such as 'x'), an escape sequence (such as '\t'), or a universal character (such as '\u02C0').Let us see an example how ... Read More

How to copy a section of an array into another array in C#?

Chandu yadav

Chandu yadav

Updated on 21-Jun-2020 13:38:56

207 Views

The Array.Copy() method in C# is used to copy section of one array to another array.The following is the syntax −Array.Copy(src, dest, length);Here, src = array to be copieddest = destination arraylength = how many elements to copyThe following is an example showing the usage of Copy(, , ) method ... Read More

How to copy a section of one Array to another in C#?

Chandu yadav

Chandu yadav

Updated on 21-Jun-2020 13:27:54

3K+ Views

The Array.Copy() method in C# is used to copy section of one array to another array.The following is the syntax −Array.Copy(src, dest, length);Here, src = array to be copieddest = destination arraylength = how many elements to copyThe following is an example showing the usage of Copy(, , ) method ... Read More

Value parameters vs Reference parameters vs Output Parameters in C#

Chandu yadav

Chandu yadav

Updated on 21-Jun-2020 13:15:38

2K+ Views

Value parametersThe value parameters copy the actual value of an argument into the formal parameter of the function. In this case, changes made to the parameter inside the function have no effect on the argument.This is the default mechanism for passing parameters to a method. In this mechanism, when a ... Read More

What is a static class in C#?

Chandu yadav

Chandu yadav

Updated on 21-Jun-2020 12:45:28

427 Views

The C# static class cannot be instantiated and can only have only static members. The static class in C# is sealed and cannot contain instance constructors.The following is an example with static class and static members −Exampleusing System; public static class Demo {    public static float PI = ... Read More

Advertisements