AmitDiwan has Published 10740 Articles

Get a specific interface implemented or inherited by the current Type in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 09:59:31

143 Views

To get a specific interface implemented or inherited by the current Type, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       Type type = typeof(double);       Type myInterface = type.GetInterface("IFormattable");       Console.WriteLine("Interface = "+myInterface); ... Read More

Get the TypeCode for value type UInt64 in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 08:16:17

176 Views

To get the TypeCode for value type UInt64, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       ulong val1 = 55;       ulong val2 = 100;       TypeCode type1 = val1.GetTypeCode();       ... Read More

Check whether the Dictionary contains a specific value or not in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 08:13:50

469 Views

To check whether the Dictionary contains a specific value or not, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       Dictionary dict =       new Dictionary();       dict.Add("One", "John");       ... Read More

Method Parameters in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 08:08:00

568 Views

The parameters are used to pass and receive data from a method. Let us first see the syntax −Access Specifier − This determines the visibility of a variable or a method from another class.Return type − A method may return a value. The return type is the data type of ... Read More

Reverse the order of the elements in the entire List or in the specified range in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 08:05:55

287 Views

To reverse the order of the elements in the entire List, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(String[] args) {       List list = new List();       list.Add("One");       list.Add("Two");     ... Read More

Reverse the order of the elements in the entire ArrayList or in the specified range in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:55:44

218 Views

To reverse the order of the elements in the entire ArrayList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(String[] args) {       ArrayList list1 = new ArrayList();       list1.Add("A");       list1.Add("B");     ... Read More

Set all bits in the BitArray to the specified value in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:50:46

116 Views

To set all bits in the BitArray to the specified value, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       BitArray arr = new BitArray(5);       arr[0] = false;       arr[1] = ... Read More

Byte Struct in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:46:18

317 Views

Byte Struct in C# represents an 8-bit unsigned integer. Following are the fields −Sr.noField & Description1MaxValueRepresents the largest possible value of a Byte. This field is constant.2MinValueRepresents the smallest possible value of a Byte. This field is constant.Following are some of the methods −Sr.noField & Description1CompareTo(Byte)Compares this instance to a ... Read More

Finally keyword in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:41:28

3K+ Views

The finally keyword is used as a block to execute a given set of statements, whether an exception is thrown or not thrown. For example, if you open a file, it must be closed whether an exception is raised or not.SyntaxFollowing is the syntax −try {    // statements causing ... Read More

Get the HashCode for the current UInt64 instance in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:38:32

179 Views

To get the HashCode for the current UInt64 instance, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       ulong val1 = 8768768;       ulong val2 = UInt64.MinValue;       Console.WriteLine("HashCode for val1 = "+val1.GetHashCode());   ... Read More

Advertisements