Decimal.GetBits() Method in C# Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report Decimal.GetBits() Method is used to convert the value of a specified instance of Decimal to its equivalent binary representation. Syntax: public static int[] GetBits (decimal d); Here, it takes the floating point value to convert. Return Value: This method returns a 32-bit signed integer array with four elements that contain the binary representation of d. Below programs illustrate the use of Decimal.GetBits() Method Example 1: csharp // C# program to demonstrate the // Decimal.GetBits() Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // Declaring and initializing value decimal value = 18446744073709551615M; // getting Equivalent bit // using GetBits() method int[] arr = Decimal.GetBits(value); // Display the element for (int i = 0; i < arr.Length; i++) Console.WriteLine("Bit[{0}] = {1, 10:X8}", i, arr[i]); } } Output: Bit[0] = FFFFFFFF Bit[1] = FFFFFFFF Bit[2] = 00000000 Bit[3] = 00000000 Example 2: csharp // C# program to demonstrate the // Decimal.GetBits() Method using System; using System.Globalization; class GFG { // Main Method public static void Main() { // calling get() method get(Decimal.MaxValue); Console.WriteLine(""); get(Decimal.MinValue); } // defining get() method public static void get(decimal value) { // getting Equivalent bit // using GetBits() method Console.WriteLine("Converted value of {0} is", value); int[] arr = Decimal.GetBits(value); // Display the element for (int i = 0; i < arr.Length; i++) Console.WriteLine("Bit[{0}] = {1, 10:X8}", i, arr[i]); } } Output: Converted value of 79228162514264337593543950335 is Bit[0] = FFFFFFFF Bit[1] = FFFFFFFF Bit[2] = FFFFFFFF Bit[3] = 00000000 Converted value of -79228162514264337593543950335 is Bit[0] = FFFFFFFF Bit[1] = FFFFFFFF Bit[2] = FFFFFFFF Bit[3] = 80000000 Reference: https://learn.microsoft.com/en-us/dotnet/api/system.decimal.getbits?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article Decimal.ToInt64() Method in C# R rohitprasad3 Follow Improve Article Tags : C# CSharp-method CSharp-Decimal-Struct Similar Reads Decimal.ToByte() Method in C# This method is used to converts the value of the specified Decimal to the equivalent 8-bit unsigned integer. Syntax: public static byte ToByte (decimal a); Parameter: a: This parameter specifies the decimal which will be negated. Return Value: An 8-bit unsigned integer equivalent to a will be return 2 min read Decimal.ToSByte() Method in C# This method is used to convert the value of the specified Decimal to the equivalent 8-bit signed integer. A user can also convert a Decimal value to an 8-bit integer by using the Explicit assignment operator. Syntax: public static sbyte ToSByte (decimal value); Here, the value is the decimal number 2 min read Decimal.ToInt32() Method in C# This method is used to convert the value of the specified Decimal to the equivalent 32-bit signed integer. A user can also convert a Decimal value to a 32-bit integer by using the Explicit assignment operator. Syntax: public static int ToInt32 (decimal value); Here, the value is the decimal number w 2 min read Decimal.ToInt64() Method in C# This method is used to convert the value of the specified Decimal to the equivalent 64-bit signed integer. A user can also convert a Decimal value to a 64-bit integer by using the Explicit assignment operator. Syntax: public static long ToInt64 (decimal d); Here, the value is the decimal number whic 2 min read Decimal.ToInt16() Method in C# This method is used to convert the value of the specified Decimal to the equivalent 16-bit signed integer. A user can also convert a Decimal value to a 16-bit integer by using the Explicit assignment operator. Syntax: public static short ToInt16 (decimal value); Here, the value is the decimal number 2 min read Decimal.ToUInt32() Method in C# This method is used to convert the value of the specified Decimal to the equivalent 32-bit unsigned integer. A user can also convert a Decimal value to a 32-bit unsigned integer by using the Explicit assignment operator. Syntax: public static uint ToUInt32 (decimal d); Here, the d is the decimal num 2 min read Like