<Type Name="BitConverter" FullName="System.BitConverter">
  <TypeSignature Maintainer="auto" Language="C#" Value="public static class BitConverter" />
  <AssemblyInfo>
    <AssemblyName>mscorlib</AssemblyName>
    <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00]</AssemblyPublicKey>
    <AssemblyVersion>2.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the &lt;link location="node:gtk-sharp/programming/threads"&gt;Gtk# Thread Programming&lt;/link&gt; for details.</ThreadSafetyStatement>
  <Base>
    <BaseTypeName>System.Object</BaseTypeName>
  </Base>
  <Interfaces />
  <Docs>
    <summary>Use BitConverter class to work with binary representations of value types.</summary>
    <remarks>This class returns a value type from an array of bytes or an array of bytes that is the binary representation of a value type. This lets you work with streams of bytes that are binary representations of value types, for example a file or a socket. The class also has a <see cref="T:System.Boolean" /> Field (<see cref="F:System.BitConverter.IsLittleEndian" />) that indicates wherever the CPU is Little Endian or not.

<para><example>
In this example we convert the number 3516 (0x0DBC in hexadecimal) from binary to <see cref="T:System.Int16" />. This code works only in a Little Endian Machine. If your Machine is Big Endian, change the indexs of the data <see cref="T:System.Array" />.
<code lang="C#">
public class TestBitConverter 
{
	public static void Main() {
		// The hexadecimal representation of the number 3516 is 0x0DBC
		byte[] data = new byte[2];
		data[0] = 0xBC; // Little Endian Machine
		data[1] = 0x0D;
		
		short num = System.BitConverter.ToInt16(data, 0);
		System.Console.WriteLine("LittleEndian: {0}", System.BitConverter.IsLittleEndian? "yes" : "no" );
		System.Console.WriteLine("Number: {0}", num);
	}
}		
  </code>

The output is:
<code>LittleEndian: yes
Number: 3516</code></example></para></remarks>
  </Docs>
  <Members>
    <Member MemberName="DoubleToInt64Bits">
      <MemberSignature Language="C#" Value="public static long DoubleToInt64Bits (double value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Int64</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Double" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'double'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'long'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="C#" Value="public static byte[] GetBytes (bool value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Byte[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Boolean" />
      </Parameters>
      <Docs>
        <param name="value">The value to convert in binary data</param>
        <summary>Returns the binary representation of the <see cref="T:System.Boolean" /> value</summary>
        <returns>The binary representation of the value as an <see cref="T:System.Array" /> of bytes</returns>
        <remarks>Returns 1 byte (true: 1, false: 0)</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="C#" Value="public static byte[] GetBytes (char value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Byte[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Char" />
      </Parameters>
      <Docs>
        <param name="value">The value to convert in binary data</param>
        <summary>Returns the binary representation of the <see cref="T:System.Char" /> value</summary>
        <returns>The binary representation of the value as an <see cref="T:System.Array" /> of bytes</returns>
        <remarks>Returns 2 bytes (16-bit Unicode character, see <see cref="T:System.Char" />)</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="C#" Value="public static byte[] GetBytes (double value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Byte[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Double" />
      </Parameters>
      <Docs>
        <param name="value">The value to convert in binary data</param>
        <summary>Returns the binary representation of the <see cref="T:System.Double" /> value</summary>
        <returns>The binary representation of the value as an <see cref="T:System.Array" /> of bytes</returns>
        <remarks>Returns 8 bytes (64-bit double-precision floating-point number, see <see cref="T:System.Double" />)</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="C#" Value="public static byte[] GetBytes (short value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Byte[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Int16" />
      </Parameters>
      <Docs>
        <param name="value">The value to convert in binary data</param>
        <summary>Returns the binary representation of the <see cref="T:System.Int16" /> value</summary>
        <returns>The binary representation of the value as an <see cref="T:System.Array" /> of bytes</returns>
        <remarks>Returns 2 bytes (16-bits signed integer, see <see cref="T:System.Int16" />)</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="C#" Value="public static byte[] GetBytes (int value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Byte[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">The value to convert in binary data </param>
        <summary>Returns the binary representation of the <see cref="T:System.Int32" /> value</summary>
        <returns>The binary representation of the value as an <see cref="T:System.Array" /> of bytes</returns>
        <remarks>Returns 4 bytes (32-bits signed integer, see <see cref="T:System.Int32" />)</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="C#" Value="public static byte[] GetBytes (long value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Byte[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Int64" />
      </Parameters>
      <Docs>
        <param name="value">The value to convert in binary data </param>
        <summary>Returns the binary representation of the <see cref="T:System.Int64" /> value</summary>
        <returns>The binary representation of the value as an <see cref="T:System.Array" /> of bytes</returns>
        <remarks>Returns 8 bytes (64-bits signed integer, see <see cref="T:System.Int64" />)</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="C#" Value="public static byte[] GetBytes (float value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Byte[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Single" />
      </Parameters>
      <Docs>
        <param name="value">The value to convert in binary data</param>
        <summary>Returns the binary representation of the <see cref="T:System.Single" /> value
</summary>
        <returns>The binary representation of the value as an <see cref="T:System.Array" /> of bytes</returns>
        <remarks>Returns 4 bytes (32-bit single-precision floating-point number, see <see cref="T:System.Single" />)</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="C#" Value="public static byte[] GetBytes (ushort value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Byte[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.UInt16" />
      </Parameters>
      <Docs>
        <param name="value">The value to convert in binary data</param>
        <summary>Returns the binary representation of the <see cref="T:System.UInt16" /> value</summary>
        <returns>The binary representation of the value as an <see cref="T:System.Array" /> of bytes
        </returns>
        <remarks>Returns 2 bytes (16-bits unsigned integer, see <see cref="T:System.UInt16" />)</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="C#" Value="public static byte[] GetBytes (uint value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Byte[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.UInt32" />
      </Parameters>
      <Docs>
        <param name="value">The value to convert in binary data</param>
        <summary>Returns the binary representation of the <see cref="T:System.UInt32" /> value</summary>
        <returns>The binary representation of the value as an <see cref="T:System.Array" /> of bytes</returns>
        <remarks>Returns 4 bytes (32-bits unsigned integer, see <see cref="T:System.UInt32" />)</remarks>
      </Docs>
    </Member>
    <Member MemberName="GetBytes">
      <MemberSignature Language="C#" Value="public static byte[] GetBytes (ulong value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Byte[]</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.UInt64" />
      </Parameters>
      <Docs>
        <param name="value">The value to convert in binary data</param>
        <summary>Returns the binary representation of the <see cref="T:System.UInt64" /> value</summary>
        <returns>The binary representation of the value as an <see cref="T:System.Array" /> of bytes</returns>
        <remarks>Returns 8 bytes (64-bits unsigned integer, see <see cref="T:System.UInt64" />)</remarks>
      </Docs>
    </Member>
    <Member MemberName="Int64BitsToDouble">
      <MemberSignature Language="C#" Value="public static double Int64BitsToDouble (long value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Double</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Int64" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'long'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'double'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="IsLittleEndian">
      <MemberSignature Language="C#" Value="public static readonly bool IsLittleEndian;" />
      <MemberType>Field</MemberType>
      <ReturnValue>
        <ReturnType>System.Boolean</ReturnType>
      </ReturnValue>
      <Parameters />
      <Docs>
        <summary>Get the Endianess of the Machine. </summary>
        <remarks>True for Little Endian Machine (least significant byte will be at position 0).</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToBoolean">
      <MemberSignature Language="C#" Value="public static bool ToBoolean (byte[] value, int startIndex);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Boolean</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">A <see cref="T:System.Int32" /> containing the index from which to start the conversion.</param>
        <summary>Returns the <see cref="T:System.Boolean" /> value from a given byte</summary>
        <returns>To be added: an object of type 'bool'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToChar">
      <MemberSignature Language="C#" Value="public static char ToChar (byte[] value, int startIndex);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Char</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">To be added: an object of type 'int'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'char'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToDouble">
      <MemberSignature Language="C#" Value="public static double ToDouble (byte[] value, int startIndex);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Double</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">To be added: an object of type 'int'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'double'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToInt16">
      <MemberSignature Language="C#" Value="public static short ToInt16 (byte[] value, int startIndex);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Int16</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">To be added: an object of type 'int'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'short'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToInt32">
      <MemberSignature Language="C#" Value="public static int ToInt32 (byte[] value, int startIndex);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Int32</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">To be added: an object of type 'int'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'int'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToInt64">
      <MemberSignature Language="C#" Value="public static long ToInt64 (byte[] value, int startIndex);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Int64</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">To be added: an object of type 'int'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'long'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToSingle">
      <MemberSignature Language="C#" Value="public static float ToSingle (byte[] value, int startIndex);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.Single</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">To be added: an object of type 'int'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'float'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToString">
      <MemberSignature Language="C#" Value="public static string ToString (byte[] value);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.String</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'string'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToString">
      <MemberSignature Language="C#" Value="public static string ToString (byte[] value, int startIndex);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.String</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">To be added: an object of type 'int'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'string'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToString">
      <MemberSignature Language="C#" Value="public static string ToString (byte[] value, int startIndex, int length);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.String</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
        <Parameter Name="length" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">To be added: an object of type 'int'</param>
        <param name="length">To be added: an object of type 'int'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'string'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToUInt16">
      <MemberSignature Language="C#" Value="public static ushort ToUInt16 (byte[] value, int startIndex);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.UInt16</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">To be added: an object of type 'int'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'ushort'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToUInt32">
      <MemberSignature Language="C#" Value="public static uint ToUInt32 (byte[] value, int startIndex);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.UInt32</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">To be added: an object of type 'int'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'uint'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
    <Member MemberName="ToUInt64">
      <MemberSignature Language="C#" Value="public static ulong ToUInt64 (byte[] value, int startIndex);" />
      <MemberType>Method</MemberType>
      <ReturnValue>
        <ReturnType>System.UInt64</ReturnType>
      </ReturnValue>
      <Parameters>
        <Parameter Name="value" Type="System.Byte[]" />
        <Parameter Name="startIndex" Type="System.Int32" />
      </Parameters>
      <Docs>
        <param name="value">To be added: an object of type 'byte []'</param>
        <param name="startIndex">To be added: an object of type 'int'</param>
        <summary>To be added</summary>
        <returns>To be added: an object of type 'ulong'</returns>
        <remarks>To be added</remarks>
      </Docs>
    </Member>
  </Members>
</Type>
