Csharp Articles

Page 49 of 196

Convert the specified double-precision floating point number to a 64-bit signed integer in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 436 Views

To convert a double-precision floating point number to its 64-bit signed integer representation, C# provides the BitConverter.DoubleToInt64Bits() method. This method converts the binary representation of a double value into a long integer without changing the underlying bit pattern. This is useful when you need to examine the internal binary structure of floating-point numbers or perform low-level operations on their bit representations. Syntax Following is the syntax for converting a double to its 64-bit signed integer representation − long result = BitConverter.DoubleToInt64Bits(doubleValue); Parameters The DoubleToInt64Bits() method takes one parameter − value: ...

Read More

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

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 436 Views

To convert the value of a specified string to its equivalent Unicode character in C#, you can use the Char.TryParse method. This method attempts to convert a string representation to a single Unicode character and returns a boolean indicating whether the conversion was successful. Syntax Following is the syntax for Char.TryParse method − public static bool TryParse(string s, out char result) Parameters s − The string to convert. Must be exactly one character long for successful conversion. result − When the method returns, contains the Unicode character equivalent if ...

Read More

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

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 563 Views

The BitConverter.Int64BitsToDouble() method in C# reinterprets the bit pattern of a 64-bit signed integer as a double-precision floating point number. This is not a numeric conversion − it treats the integer's binary representation as if it were the IEEE 754 double format. Syntax Following is the syntax for the Int64BitsToDouble method − public static double Int64BitsToDouble(long value) Parameters value − A 64-bit signed integer whose bit pattern will be reinterpreted as a double. Return Value Returns a double-precision floating point number whose bit representation is equivalent to the input ...

Read More

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

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 670 Views

The Dictionary class in C# provides the Count property to get the number of key/value pairs stored in the dictionary. This property returns an integer representing the total count of elements currently in the dictionary. Syntax Following is the syntax for using the Count property − Dictionary dictionary = new Dictionary(); int count = dictionary.Count; Parameters The Count property does not take any parameters. It is a read-only property that returns the current number of key/value pairs in the dictionary. Return Value The Count property returns an int value representing the ...

Read More

ConvertDecimal to equivalent 32-bit unsigned integer in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 525 Views

To convert the value of the specified decimal to the equivalent 32-bit unsigned integer, C# provides the Decimal.ToUInt32() method. This method truncates the fractional part and returns only the whole number portion as a uint value. Syntax Following is the syntax for converting decimal to uint − public static uint ToUInt32(decimal value); Parameters value − The decimal number to be converted to a 32-bit unsigned integer. Return Value Returns a 32-bit unsigned integer (uint) equivalent to the specified decimal value. The fractional part is truncated, not rounded. Using ...

Read More

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

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 665 Views

To convert the value of a Decimal to the equivalent 64-bit unsigned integer (ulong), C# provides the Decimal.ToUInt64() method. This method truncates the decimal portion and returns only the integer part as a ulong value. Syntax Following is the syntax for converting a decimal to 64-bit unsigned integer − ulong result = Decimal.ToUInt64(decimalValue); Parameters decimalValue − A Decimal number to be converted to a 64-bit unsigned integer. Return Value Returns a ulong value equivalent to the decimal value, with the fractional part truncated (not rounded). Using Decimal.ToUInt64() with ...

Read More

Get the TypeCode for value type Int32 in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 196 Views

The TypeCode enumeration in C# represents the type of an object. For Int32 values, the GetTypeCode() method returns TypeCode.Int32, which identifies the value as a 32-bit signed integer. The GetTypeCode() method is inherited from the Object class and implemented by value types to return their specific type identifier. Syntax Following is the syntax for getting the TypeCode of an Int32 value − TypeCode typeCode = intValue.GetTypeCode(); Return Value The GetTypeCode() method returns TypeCode.Int32 for all int variables, regardless of their actual numeric value. Using GetTypeCode() with Int32 Values Example ...

Read More

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

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 159 Views

The UInt64.Equals() method in C# determines whether the current UInt64 instance is equal to a specified object or another UInt64 value. This method returns true if the values are equal, otherwise false. The Equals() method is inherited from the Object class and overridden in the UInt64 structure to provide value-based comparison rather than reference comparison. Syntax Following is the syntax for the UInt64.Equals() method − public bool Equals(object obj) public bool Equals(ulong value) Parameters obj − The object to compare with the current instance. value − A UInt64 ...

Read More

Get the HashCode for the current UInt64 instance in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 208 Views

The GetHashCode() method in C# returns a hash code for the current UInt64 instance. Hash codes are primarily used in hash tables and dictionaries to quickly locate objects. For UInt64 values, the hash code is typically derived from the numeric value itself. Syntax Following is the syntax for getting the hash code of a UInt64 instance − public override int GetHashCode() Return Value The method returns a 32-bit signed integer hash code representing the current UInt64 value. Using GetHashCode() with Small Values For smaller UInt64 values that fit within the range ...

Read More

Byte Struct in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 342 Views

The byte struct in C# represents an 8-bit unsigned integer that can store values from 0 to 255. It is one of the fundamental value types in .NET and provides various methods for comparison, conversion, and formatting operations. Syntax Following is the syntax for declaring and initializing a byte variable − byte variableName = value; // value must be between 0 and 255 Fields The byte struct provides two important constant fields − Field Description Value MaxValue Represents the largest possible value of a ...

Read More
Showing 481–490 of 1,951 articles
« Prev 1 47 48 49 50 51 196 Next »
Advertisements