uint64 GetTypeCode Method in C# with Examples

AmitDiwan
Updated on 07-Nov-2019 06:53:06

135 Views

The UInt64.GetTypeCode() method in C# is used to return the TypeCode for value type UInt64.SyntaxFollowing is the syntax −public TypeCode GetTypeCode ();ExampleLet us now see an example to implement the UInt64.GetTypeCode() method −using System; public class Demo {    public static void Main(){       ulong val1 = 55;       ulong val2 = 100;       TypeCode type1 = val1.GetTypeCode();       TypeCode type2 = val2.GetTypeCode();       Console.WriteLine("Typecode for val1 = "+type1);       Console.WriteLine("Typecode for val2 = "+type2);    } }OutputThis will produce the following output −Typecode for val1 = UInt64 ... Read More

UInt64 Equals Method in CHash with Examples

AmitDiwan
Updated on 07-Nov-2019 06:49:12

155 Views

The UInt64.Equals() method in C# returns a value indicating whether this instance is equal to a specified object or UInt64.SyntaxFollowing is the syntax −public override bool Equals (object ob); public bool Equals (ulong ob);Above, the parameter ob for the 1st syntax is an object to compare to this instance and the parameter ob for the 2nd syntax is the 64-bit unsigned integer to compare to this instance.ExampleLet us now see an example to implement the UInt64.Equals() method −using System; public class Demo {    public static void Main(){       ulong val1 = 44565777;       ulong val2 ... Read More

UInt64 CompareTo Method in C# with Examples

AmitDiwan
Updated on 07-Nov-2019 06:46:28

222 Views

The UInt64.CompareTo() method in C# is used to compare the current instance to a specified object or UInt64 and returns an indication of their relative values.SyntaxFollowing is the syntax −public int CompareTo (object val); public int CompareTo (ulong val;Above, the value for the 1st syntax is an object to compare. The value for 2nd syntax is an unsigned integer to compare.The return value is 0 if the current instance is equal to value. It’s less than zero if the current instance is less than Val. The return value is more than zero if the current instance is greater than the ... Read More

Int32 GetTypeCode Method in C# with Examples

AmitDiwan
Updated on 07-Nov-2019 06:43:30

159 Views

The Int32.GetTypeCode() method in C# is used to return the TypeCode for value type Int32.SyntaxFollowing is the syntax −public TypeCode GetTypeCode ();ExampleLet us now see an example to implement the Int32.GetTypeCode() method −using System; public class Demo {    public static void Main(){       int val1 = 100;       int val2 = 50;       Console.WriteLine("Value1 = "+val1);       Console.WriteLine("Value2 = "+val2);       Console.WriteLine("Are they equal? = "+val1.Equals(val2));       Console.WriteLine("HashCode for Value1 = "+val1.GetHashCode());       Console.WriteLine("HashCode for Value2 = "+val2.GetHashCode());       TypeCode type1 = val1.GetTypeCode(); ... Read More

Decimal Truncate Method in C#

AmitDiwan
Updated on 07-Nov-2019 06:40:45

1K+ Views

The Decimal.Truncate() method in C# is used to return the integral digits of the specified Decimal. Remember, any fractional digits are discarded.SyntaxFollowing is the syntax −public static decimal Truncate (decimal val);Above, Val is the decimal number to truncate.ExampleLet us now see an example to implement the Decimal.Truncate() method −using System; public class Demo {    public static void Main(){       Decimal val = 6576.876m;       Console.WriteLine("Decimal value = "+val);       ulong res = Decimal.ToUInt64(val);       Console.WriteLine("64-bit unsigned integer = "+res);       Decimal val2 = Decimal.Truncate(val);       Console.WriteLine("Integral digits ... Read More

Decimal to UInt64 Method in C#

AmitDiwan
Updated on 07-Nov-2019 06:38:41

70 Views

The Decimal.ToUInt64() method in C# is used to convert the value of the specified Decimal to the equivalent 64-bit unsigned integer.SyntaxFollowing is the syntax −public static ulong ToUInt64 (decimal val);Above, Val is the decimal number to convert.ExampleLet us now see an example to implement the Decimal.ToUInt64() method −using System; public class Demo {    public static void Main(){       Decimal val = 99.29m;       Console.WriteLine("Decimal value = "+val);       ulong res = Decimal.ToUInt64(val);       Console.WriteLine("64-bit unsigned integer = "+res);    } }OutputThis will produce the following output −Decimal value = 99.29 64-bit ... Read More

Decimal to UInt32 Method in C#

AmitDiwan
Updated on 07-Nov-2019 06:33:27

106 Views

The Decimal.ToUInt32() method in C# is used to convert the value of the specified Decimal to the equivalent 32-bit unsigned integer.SyntaxFollowing is the syntax −public static uint ToUInt32 (decimal val);Above, Val is the decimal number to convert.ExampleLet us now see an example to implement the Decimal.ToUInt32() method −using System; public class Demo {    public static void Main(){       Decimal val = 0.001m;       Console.WriteLine("Decimal value = "+val);       uint res = Decimal.ToUInt32(val);       Console.WriteLine("32-bit unsigned integer = "+res);    } }OutputThis will produce the following output −Decimal value = 0.001 32-bit ... Read More

BitConverter.Int64BitsToDouble Method in C#

AmitDiwan
Updated on 07-Nov-2019 06:31:18

120 Views

The BitConverter.Int64BitsToDouble() method in C# is used to reinterpret the specified 64-bit signed integer to a double-precision floating-point number.SyntaxFollowing is the syntax −public static double Int64BitsToDouble (long val);Above, the parameter value is the number to convert.ExampleLet us now see an example to implement the BitConverter.Int64BitsToDouble() method −using System; public class Demo {    public static void Main(){       long d = 9846587687;       Console.Write("Value (64-bit signed integer) = "+d);       double res = BitConverter.Int64BitsToDouble(d);       Console.Write("Value (double-precision floating point number) = "+res);    } }OutputThis will produce the following output −Value (64-bit ... Read More

BitConverter.DoubleToInt64Bits Method in C#

AmitDiwan
Updated on 07-Nov-2019 06:29:06

116 Views

The BitConverter.DoubleToInt64Bits() method in C# is used to convert the specified double-precision floating-point number to a 64-bit signed integer.SyntaxFollowing is the syntax −public static long DoubleToInt64Bits (double val);Above, Val is the number to convert.ExampleLet us now see an example to implement the BitConverter.DoubleToInt64Bits() method −using System; public class Demo {    public static void Main(){       double d = 5.646587687;       Console.Write("Value = "+d);       long res = BitConverter.DoubleToInt64Bits(d);       Console.Write("64-bit signed integer = "+res);    } }OutputThis will produce the following output −Value = 5.646587687 64-bit signed integer = 4618043510978159912ExampleLet us ... Read More

DateTime ToFileTime Method in C#

AmitDiwan
Updated on 07-Nov-2019 06:05:52

570 Views

The DateTime.ToFileTime() method in C# is used to convert the value of the current DateTime object to a Windows file time.SyntaxFollowing is the syntax −public long ToFileTime ();ExampleLet us now see an example to implement the DateTime.ToFileTime() method −using System; public class Demo {    public static void Main() {       DateTime d = DateTime.Now;       Console.WriteLine("Date = {0}", d);       long res = d.ToFileTime();       Console.WriteLine("Windows file time = {0}", res);    } }OutputThis will produce the following output −Date = 10/16/2019 8:17:26 AM Windows file time = 132156874462559390ExampleLet us now ... Read More

Advertisements