AmitDiwan has Published 10744 Articles

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

141 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

Get a value indicating whether this instance is equal to a specified object or UInt64 in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:36:06

102 Views

To return a value indicating whether this instance is equal to a specified object or UInt64, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       ulong val1 = 44565777;       ulong val2 = 77878787;     ... Read More

Get the TypeCode for value type Int32 in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:33:57

142 Views

To get the TypeCode for value type Int32, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       int val1 = 100;       int val2 = 50;       Console.WriteLine("Value1 = "+val1);       Console.WriteLine("Value2 ... Read More

Convert Decimal to the equivalent 64-bit unsigned integer in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:29:52

587 Views

To convert the value of the specified Decimal to the equivalent 64-bit unsigned integer, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       Decimal val = 99.29m;       Console.WriteLine("Decimal value = "+val);       ulong ... Read More

Indicate whether this instance is equal to a specified object or UInt16 in C#

AmitDiwan

AmitDiwan

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

102 Views

To indicate whether this instance is equal to a specified object or UInt16, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(){       ushort val1 = 52;       ushort val2 = 10;       bool res = ... Read More

ConvertDecimal to equivalent 32-bit unsigned integer in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:25:14

444 Views

To convert the value of the specified Decimal to the equivalent 32-bit unsigned integer, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       Decimal val = 0.001m;       Console.WriteLine("Decimal value = "+val);       uint ... Read More

Get the number of key/value pairs in the Dictionary in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:24:04

576 Views

To get the number of key/value pairs in the Dictionary, 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", "Chris");       dict.Add("Two", "Steve"); ... Read More

Reinterpret 64-bit signed integer to a double-precision floating point number in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:22:35

485 Views

To reinterpret the specified 64-bit signed integer to a double-precision floating point number, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       long d = 9846587687;       Console.Write("Value (64-bit signed integer) = "+d);       ... Read More

Convert the value of the specified string to its equivalent Unicode character in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:21:24

376 Views

To convert the value of the specified string to its equivalent Unicode character, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main(){       bool res;       Char ch;       res = Char.TryParse("10", out ch);     ... Read More

Advertisements