System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Object [System.Runtime.CompilerServices.Nullable(0)] [<System.Runtime.CompilerServices.Nullable(0)>] Converts a base data type to another base data type. For more information about this API, see Supplemental API remarks for Convert. Type Conversion in .NET System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Returns an object of a specified type whose value is equivalent to a specified object. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Object [System.Runtime.CompilerServices.Nullable(1)] [<System.Runtime.CompilerServices.Nullable(1)>] An object that implements the interface. The type of object to return. Returns an object of the specified type and whose value is equivalent to the specified object. An object whose type is and whose value is equivalent to . -or- A null reference ( in Visual Basic), if is and is not a value type. is a general-purpose conversion method that converts the object specified by `value` to `conversionType`. The `value` parameter can be an object of any type, and `conversionType` can also be a object that represents any base or custom type. For the conversion to succeed, `value` must implement the interface, because the method simply wraps a call to an appropriate method. The method requires that conversion of `value` to `conversionType` be supported. This method uses the current thread's culture for the conversion. ## Examples The following example illustrates the use of the method. :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/convertchangetype.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/convertchangetype.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ChangeType/convertchangetype.vb" id="Snippet1"::: ]]> This conversion is not supported. -or- is and is a value type. -or- does not implement the interface. is not in a format recognized by . represents a number that is out of the range of . is . The method can convert an enumeration value to another type. However, it cannot convert another type to an enumeration value, even if the source type is the underlying type of the enumeration. To convert a type to an enumeration value, use a casting operator (in C#) or a conversion function (in Visual Basic). The following example illustrates the conversion to and from a Continent enumeration value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype_enum2.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype_enum2.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ChangeType/changetype_enum2.vb" id="Snippet5"::: The method can convert a nullable type to another type. However, it cannot convert another type to a value of a nullable type, even if is the underlying type of the .To perform the conversion, you can use a casting operator (in C#) or a conversion function (in Visual Basic). The following example illustrates the conversion to and from a nullable type. :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype_nullable.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype_nullable.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ChangeType/changetype_nullable.vb" id="Snippet7"::: Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Object [System.Diagnostics.CodeAnalysis.NotNullIfNotNull("value")] [<System.Diagnostics.CodeAnalysis.NotNullIfNotNull("value")>] An object that implements the interface. The type of object to return. Returns an object of the specified type whose value is equivalent to the specified object. An object whose underlying type is and whose value is equivalent to . -or- A null reference ( in Visual Basic), if is and is , , or . is a general-purpose conversion method that converts the object specified by `value` to a predefined type specified by `typeCode`. The `value` parameter can be an object of any type. For the conversion to succeed, `value` must implement the interface, because the method simply wraps a call to an appropriate method. The method also requires that conversion of `value` to `typeCode` be supported. The method does not support the conversion of `value` to a custom type. To perform such a conversion, call the method. ## Examples The following example illustrates how to use the method to change an to the type specified by the parameter, if possible. :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype01.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype01.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ChangeType/changetype01.vb" id="Snippet2"::: ]]> This conversion is not supported. -or- is and specifies a value type. -or- does not implement the interface. is not in a format recognized by the type. represents a number that is out of the range of the type. is invalid. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Object [System.Runtime.CompilerServices.Nullable(1)] [<System.Runtime.CompilerServices.Nullable(1)>] An object that implements the interface. The type of object to return. An object that supplies culture-specific formatting information. Returns an object of the specified type whose value is equivalent to the specified object. A parameter supplies culture-specific formatting information. An object whose type is and whose value is equivalent to . -or- , if the of and are equal. -or- A null reference ( in Visual Basic), if is and is not a value type. is a general-purpose conversion method that converts the object specified by `value` to `conversionType`. The `value` parameter can be an object of any type, and `conversionType` can also be a object that represents any base or custom type. For the conversion to succeed, `value` must implement the interface, because the method simply wraps a call to an appropriate method. The method requires that conversion of `value` to `conversionType` be supported. The `provider` parameter is an implementation that supplies formatting information for the conversion. Whether and how this parameter is used depends on the underlying implementation. If `value` is a base data type, `provider` is used only for the following conversions: - Conversion from a number to a string, or from a string to a number. `provider` must be a object, a object, or a custom implementation that returns a object. However, because the method performs the conversion using the default "G" format specifier, the `provider` parameter has no effect if `value` or the target type is an unsigned integer. If `provider` is `null`, the object that represents the current culture is used. - Conversion from a value to a string, or from a string to a value. `provider` must be a or object. If `provider` is `null`, the object that represents the current culture is used. If `value` is an application-defined type, its implementation may use the `provider` parameter. ## Examples The following example defines a `Temperature` class that implements the interface. :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype03.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype03.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ChangeType/changetype03.vb" id="Snippet3"::: The following example creates an instance of the `Temperature` class and calls the method to convert it to the basic numeric types supported by .NET and to a . It illustrates that the method wraps a call to the source type's implementation. :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype03.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype03.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ChangeType/changetype03.vb" id="Snippet4"::: ]]> This conversion is not supported. -or- is and is a value type. -or- does not implement the interface. is not in a format for recognized by . represents a number that is out of the range of . is . The method can convert an enumeration value to another type. However, it cannot convert another type to an enumeration value, even if the source type is the underlying type of the enumeration. To convert a type to an enumeration value, use a casting operator (in C#) or a conversion function (in Visual Basic). The following example illustrates the conversion to and from a Continent enumeration value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype_enum2.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype_enum2.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ChangeType/changetype_enum2.vb" id="Snippet5"::: The method can convert a nullable type to another type. However, it cannot convert another type to a value of a nullable type, even if is the underlying type of the . To perform the conversion, you can use a casting operator (in C#) or a conversion function (in Visual Basic). The following example illustrates the conversion to and from a nullable type. :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype_nullable_1.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype_nullable_1.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ChangeType/changetype_nullable_1.vb" id="Snippet8"::: Method System.Runtime.Extensions 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Object An object that implements the interface. The type of object to return. An object that supplies culture-specific formatting information. Returns an object of the specified type whose value is equivalent to the specified object. A parameter supplies culture-specific formatting information. An object whose underlying type is and whose value is equivalent to . -or- A null reference ( in Visual Basic), if is and is , , or . is a general-purpose conversion method that converts the object specified by `value` to a predefined type specified by `typeCode`. The `value` parameter can be an object of any type. For the conversion to succeed, `value` must implement the interface, because the method simply wraps a call to an appropriate method. The method also requires that conversion of `value` to `typeCode` be supported. The method does not support the conversion of `value` to a custom type. To perform such a conversion, call the method. The `provider` parameter is an implementation that supplies formatting information for the conversion. Whether and how this parameter is used depends on the underlying implementation. If `value` is a base data type, `provider` is used only for the following conversions. If a `null` argument is passed to these methods, the object that represents the current culture is used. - Conversion from a number to a string, or from a string to a number. `provider` must be a object, a object, or a custom implementation that returns a object. However, because the method performs the conversion using the default "G" format specifier, the `provider` parameter has no effect if `value` or the target type is an unsigned integer. - Conversion from a value to a string, or from a string to a value. `provider` must be a or object. If `value` is an application-defined type, its implementation may use the `provider` parameter. ## Examples The following example defines a custom format provider named `InterceptProvider` that indicates when its method is called and returns a for the fr-FR culture and a object for the en-US culture. This format provider is used in all calls to the method. The example then creates an array with a and a value and makes repeated calls to with each value and each member of the enumeration. The example illustrates when the method uses the parameter and also illustrates the use of the `provider` parameter to perform culture-sensitive formatting. :::code language="csharp" source="~/snippets/csharp/System/Convert/ChangeType/changetype00.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ChangeType/changetype00.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ChangeType/changetype00.vb" id="Snippet1"::: ]]> This conversion is not supported. -or- is and specifies a value type. -or- does not implement the interface. is not in a format for the type recognized by . represents a number that is out of the range of the type. is invalid. Field mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Runtime.CompilerServices.Nullable(1)] [<System.Runtime.CompilerServices.Nullable(1)>] System.Object A constant that represents a database column that is absent of data; that is, database null. field is equivalent to , as the following example shows. :::code language="csharp" source="~/snippets/csharp/System/Convert/DBNull/dbnull1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/DBNull/dbnull1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/DBNull/dbnull1.vb" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Security.SecuritySafeCritical] [<System.Security.SecuritySafeCritical>] System.Byte[] A Unicode character array. A position within . The number of elements in to convert. Converts a subset of a Unicode character array, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array. Parameters specify the subset in the input array and the number of elements to convert. An array of 8-bit unsigned integers equivalent to elements at position in . [!IMPORTANT] > The method is designed to process a single character array that contains all the data to be decoded. To decode base-64 character data from a stream, use the class. ## Examples The following example demonstrates the use of the method to decode UUencoded (base-64) data and save it as binary output. :::code language="csharp" source="~/snippets/csharp/System/Convert/FromBase64CharArray/class1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/FromBase64CharArray/class1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/FromBase64CharArray/class1.vb" id="Snippet3"::: The following example demonstrates the and methods. The input is divided into groups of three bytes (24 bits) each. Consequently, each group consists of four 6-bit numbers where each number ranges from decimal 0 to 63. In this example, there are 85 3-byte groups with one byte remaining. The first group consists of the hexadecimal values 00, 01, and 02, which yield four 6-bit values equal to decimal 0, 0, 4, and 2. Those four values correspond to the base-64 digits, "A", "A", "E", and "C", at the beginning of the output. If an integral number of 3-byte groups does not exist, the remaining bytes are effectively padded with zeros to form a complete group. In this example, the value of the last byte is hexadecimal FF. The first 6 bits are equal to decimal 63, which corresponds to the base-64 digit "/" at the end of the output, and the next 2 bits are padded with zeros to yield decimal 48, which corresponds to the base-64 digit, "w". The last two 6-bit values are padding and correspond to the valueless padding character, "=". :::code language="csharp" source="~/snippets/csharp/System/Convert/FromBase64CharArray/tb64ca.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/FromBase64CharArray/tb64ca.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/FromBase64CharArray/tb64ca.vb" id="Snippet1"::: ]]> is . or is less than 0. -or- plus indicates a position not within . The length of , ignoring white-space characters, is not zero or a multiple of 4. -or- The format of is invalid. contains a non-base-64 character, more than two padding characters, or a non-white-space character among the padding characters. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Security.SecuritySafeCritical] [<System.Security.SecuritySafeCritical>] System.Byte[] The string to convert. Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array. An array of 8-bit unsigned integers that is equivalent to . [!IMPORTANT] > The method is designed to process a single string that contains all the data to be decoded. To decode base-64 character data from a stream, use the class. ## Examples The following example uses the method to convert a byte array to a UUencoded (base-64) string, and then calls the method to restore the original byte array. :::code language="csharp" source="~/snippets/csharp/System/Base64FormattingOptions/Overview/ToBase64String2.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Base64FormattingOptions/Overview/ToBase64String2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Base64FormattingOptions/Overview/ToBase64String2.vb" id="Snippet1"::: The following is a more complex example that creates a 20-element array of 32-bit integers. It then uses the method to convert each element into a byte array, which it stores in the appropriate position in a buffer by calling the method. This buffer is then passed to the method to create a UUencoded (base-64) string. It then calls the method to decode the UUencoded string, and calls the method to convert each set of four bytes (the size of a 32-bit integer) to an integer. The output from the example shows that the original array has been successfully restored. :::code language="csharp" source="~/snippets/csharp/System/Base64FormattingOptions/Overview/ToBase64String.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Base64FormattingOptions/Overview/ToBase64String.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Base64FormattingOptions/Overview/ToBase64String.vb" id="Snippet2"::: ]]> is . The length of , ignoring white-space characters, is not zero or a multiple of 4. -or- The format of is invalid. contains a non-base-64 character, more than two padding characters, or a non-white space-character among the padding characters. Method System.Runtime 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.Byte[] [System.Runtime.CompilerServices.Nullable(1)] [<System.Runtime.CompilerServices.Nullable(1)>] The UTF-8 span to convert. Converts the span, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array. An array of 8-bit unsigned integers that is equivalent to . To be added. The length of is not zero or a multiple of two. The format of is invalid -OR- contains a non-hex character. Method System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.Byte[] [System.Runtime.CompilerServices.Nullable(1)] [<System.Runtime.CompilerServices.Nullable(1)>] The span to convert. Converts the span, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array. An array of 8-bit unsigned integers that is equivalent to . To be added. The length of , is not zero or a multiple of 2. The format of is invalid. contains a non-hex character. Method System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.Byte[] The string to convert. Converts the specified string, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array. An array of 8-bit unsigned integers that is equivalent to . To be added. is . The length of , is not zero or a multiple of 2. The format of is invalid. contains a non-hex character. Method System.Runtime 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.Buffers.OperationStatus The span to convert. The span in which to write the converted 8-bit unsigned integers. When this method returns, contains the number of bytes that were consumed from . When this method returns, contains the number of bytes that were written to . Converts the span of UTF-8 chars, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer span. An describing the result of the operation. When this method returns a value other than , the span either remains unmodified or contains an incomplete conversion of , up to the last valid character. Method System.Runtime 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.Buffers.OperationStatus The span to convert. The span in which to write the converted 8-bit unsigned integers. When this method returns value different than , either the span remains unmodified or contains an incomplete conversion of , up to the last valid character. When this method returns, contains the number of characters that were consumed from . When this method returns, contains the number of bytes that were written to . Converts the span of chars, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer span. An describing the result of the operation. To be added. Method System.Runtime 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.Buffers.OperationStatus [System.Runtime.CompilerServices.Nullable(1)] [<System.Runtime.CompilerServices.Nullable(1)>] The string to convert. The span in which to write the converted 8-bit unsigned integers. When this method returns value different than , either the span remains unmodified or contains an incomplete conversion of , up to the last valid character. When this method returns, contains the number of characters that were consumed from . When this method returns, contains the number of bytes that were written to . Converts the string, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer span. An describing the result of the operation. To be added. Passed string is . Method System.Runtime.Extensions 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.TypeCode An object that implements the interface. Returns the for the specified object. The for , or if is . To be added. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] [<System.Diagnostics.CodeAnalysis.NotNullWhen(true)>] An object. Returns an indication whether the specified object is of type . if is of type ; otherwise, . method tests whether the `value` parameter is equal to . It is equivalent to the following code: :::code language="csharp" source="~/snippets/csharp/System/Convert/IsDBNull/Form1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/IsDBNull/Form1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/IsDBNull/Form1.vb" id="Snippet1"::: > [!NOTE] > is used to indicate a value that is missing. It is not equivalent to `null` or to . Therefore, code such as `Convert.IsDBNull(null)` in C# or `Convert.IsDBNull(Nothing)` in Visual Basic returns`false`. ## Examples The following example uses a object to retrieve survey data from a database. It assigns each row's field values to an array, and then passes each array element to the method. If the method returns `true`, the example assigns the string "NA" to the array element. The array is then added to the collection of a control. :::code language="csharp" source="~/snippets/csharp/System/Convert/IsDBNull/Form1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/IsDBNull/Form1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/IsDBNull/Form1.vb" id="Snippet2"::: ]]> System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a subset of an 8-bit unsigned integer array to an equivalent subset of a Unicode character array encoded with base-64 digits. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 An input array of 8-bit unsigned integers. A position within . The number of elements of to convert. An output array of Unicode characters. A position within . Converts a subset of an 8-bit unsigned integer array to an equivalent subset of a Unicode character array encoded with base-64 digits. Parameters specify the subsets as offsets in the input and output arrays, and the number of elements in the input array to convert. A 32-bit signed integer containing the number of bytes in . [!IMPORTANT] > The method is designed to process a single byte array that contains all the data to be encoded. To create a base-64 character array from a byte stream, use the class. ## Examples The following example demonstrates using the method to UUencode (encode in base 64) a binary stream, then save the encoding to a file. :::code language="csharp" source="~/snippets/csharp/System/Convert/FromBase64CharArray/class1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/FromBase64CharArray/class1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/FromBase64CharArray/class1.vb" id="Snippet2"::: ]]> or is . , , or is negative. -or- plus is greater than the length of . -or- plus the number of elements to return is greater than the length of . Method mscorlib 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Runtime.InteropServices.ComVisible(false)] [<System.Runtime.InteropServices.ComVisible(false)>] [System.Security.SecuritySafeCritical] [<System.Security.SecuritySafeCritical>] System.Int32 An input array of 8-bit unsigned integers. A position within . The number of elements of to convert. An output array of Unicode characters. A position within . to insert a line break every 76 characters, or to not insert line breaks. Converts a subset of an 8-bit unsigned integer array to an equivalent subset of a Unicode character array encoded with base-64 digits. Parameters specify the subsets as offsets in the input and output arrays, the number of elements in the input array to convert, and whether line breaks are inserted in the output array. A 32-bit signed integer containing the number of bytes in . [!IMPORTANT] > The method is designed to process a single byte array that contains all the data to be encoded. To create a base-64 character array from a byte stream, use the class. If the `options` parameter is set to and the output of the conversion is longer than 76 characters, a line break is inserted every 76 characters. A line break is defined as a carriage return character (U+000D) followed by a line feed character (U+000A). For more information, see RFC 2045, "Multipurpose Internet Mail Extensions", at [https://www.rfc-editor.org/](https://www.rfc-editor.org/). ## Examples The following example demonstrates the method. The input is divided into groups of three bytes (24 bits) each. Consequently, each group consists of four 6-bit numbers where each number ranges from decimal 0 to 63. In this example, there are 85 3-byte groups with one byte remaining. The first group consists of the hexadecimal values 00, 01, and 02, which yield four 6-bit values equal to decimal 0, 0, 4, and 2. Those four values correspond to the base-64 digits "A", "A", "E", and "C" at the beginning of the output. If an integral number of 3-byte groups does not exist, the remaining bytes are effectively padded with zeros to form a complete group. In this example, the value of the last byte is hexadecimal FF. The first 6 bits are equal to decimal 63, which corresponds to the base-64 digit "/" at the end of the output, and the next 2 bits are padded with zeros to yield decimal 48, which corresponds to the base-64 digit, "w". The last two 6-bit values are padding and correspond to the valueless padding character, "=". :::code language="csharp" source="~/snippets/csharp/System/Convert/FromBase64CharArray/tb64ca.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/FromBase64CharArray/tb64ca.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/FromBase64CharArray/tb64ca.vb" id="Snippet1"::: ]]> or is . , , or is negative. -or- plus is greater than the length of . -or- plus the number of elements to return is greater than the length of . is not a valid value. System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts the value of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String An array of 8-bit unsigned integers. Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits. The string representation, in base 64, of the contents of . [!IMPORTANT] > The method is designed to process a single byte array that contains all the data to be encoded. To encode data from a stream, use the class. Ordinarily, the method is not used to round-trip a UUEncoded (base-64 encoded) string. That is, if you decode a string by calling the method, then encode the returned byte array by calling the method, the resulting string will not necessarily be identical to the original string. The string will round-trip only if the original string is a valid base-64 encoded string. ## Examples The following example uses the method to convert a byte array to a UUencoded (base-64) string, and then calls the method to restore the original byte array. :::code language="csharp" source="~/snippets/csharp/System/Base64FormattingOptions/Overview/ToBase64String2.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Base64FormattingOptions/Overview/ToBase64String2.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Base64FormattingOptions/Overview/ToBase64String2.vb" id="Snippet1"::: The following is a more complex example that creates a 20-element array of 32-bit integers. It then uses the method to convert each element into a byte array, which it stores in the appropriate position in a buffer by calling the method. This buffer is then passed to the method to create a UUencoded (base-64) string. It then calls the method to decode the UUencoded string, and calls the method to convert each set of four bytes (the size of a 32-bit integer) to an integer. The output from the example shows that the original array has been successfully restored. :::code language="csharp" source="~/snippets/csharp/System/Base64FormattingOptions/Overview/ToBase64String.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Base64FormattingOptions/Overview/ToBase64String.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Base64FormattingOptions/Overview/ToBase64String.vb" id="Snippet2"::: ]]> is . Method mscorlib 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Runtime.InteropServices.ComVisible(false)] [<System.Runtime.InteropServices.ComVisible(false)>] System.String An array of 8-bit unsigned integers. to insert a line break every 76 characters, or to not insert line breaks. Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits. You can specify whether to insert line breaks in the return value. The string representation in base 64 of the elements in . [!IMPORTANT] > The method is designed to process a single byte array that contains all the data to be encoded. To encode data from a stream, use the class. If the `options` parameter is set to and the output of the conversion is longer than 76 characters, a line break is inserted every 76 characters. A line break is defined as a carriage return character (U+000D) followed by a line feed character (U+000A). Because line breaks are considered white-space characters in a base-64 encoding, they are ignored when converting a base-64 encoded string back to a byte array. The line breaks are simply convenient when displaying the encoded string to a control or a device such as a console window. For more information, see RFC 2045, "Multipurpose Internet Mail Extensions", at [https://www.rfc-editor.org/](https://www.rfc-editor.org/). ## Examples The following example calls the with a argument to insert line breaks in the string that is produced by encoding a 100-element byte array. :::code language="csharp" source="~/snippets/csharp/System/Base64FormattingOptions/Overview/ToBase64String3.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Base64FormattingOptions/Overview/ToBase64String3.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Base64FormattingOptions/Overview/ToBase64String3.vb" id="Snippet3"::: As the output from the example shows, the succeeds in restoring the original byte array; the line break characters are ignored during the conversion. ]]> is . is not a valid value. Method System.Runtime.Extensions 4.2.1.0 4.2.2.0 mscorlib netstandard 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Runtime.CompilerServices.Nullable(1)] [<System.Runtime.CompilerServices.Nullable(1)>] A read-only span of 8-bit unsigned integers. One of the enumeration values that specify whether to insert line breaks in the return value. The default value is . Converts the 8-bit unsigned integers inside the specified read-only span into their equivalent string representation that is encoded with base-64 digits. You can optionally specify whether to insert line breaks in the return value. The string representation in base 64 of the elements in . If the length of is 0, an empty string is returned. To be added. is not a valid value. The output length was larger than Int32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String An array of 8-bit unsigned integers. An offset in . The number of elements of to convert. Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits. Parameters specify the subset as an offset in the input array, and the number of elements in the array to convert. The string representation in base 64 of elements of , starting at position . [!IMPORTANT] > The method is designed to process a single byte array that contains all the data to be encoded. To encode data from a stream, use the class. ]]> is . or is negative. -or- plus is greater than the length of . Method mscorlib 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Runtime.InteropServices.ComVisible(false)] [<System.Runtime.InteropServices.ComVisible(false)>] [System.Security.SecuritySafeCritical] [<System.Security.SecuritySafeCritical>] System.String An array of 8-bit unsigned integers. An offset in . The number of elements of to convert. to insert a line break every 76 characters, or to not insert line breaks. Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits. Parameters specify the subset as an offset in the input array, the number of elements in the array to convert, and whether to insert line breaks in the return value. The string representation in base 64 of elements of , starting at position . [!IMPORTANT] > The method is designed to process a single byte array that contains all the data to be encoded. To encode data from a stream, use the class. If the `options` parameter is set to and the output of the conversion is longer than 76 characters, a line break is inserted every 76 characters. A line break is defined as a carriage return character (U+000D) followed by a line feed character (U+000A). For more information, see RFC 2045, "Multipurpose Internet Mail Extensions", at [https://www.rfc-editor.org/](https://www.rfc-editor.org/). ## Examples The following example demonstrates the method. The input is divided into groups of three bytes (24 bits) each. Consequently, each group consists of four 6-bit numbers where each number ranges from decimal 0 to 63. In this example, there are 85 3-byte groups with one byte remaining. The first group consists of the hexadecimal values 00, 01, and 02, which yield four 6-bit values equal to decimal 0, 0, 4, and 2. Those four values correspond to the base-64 digits "A", "A", "E", and "C" at the beginning of the output. If an integral number of 3-byte groups does not exist, the remaining bytes are effectively padded with zeros to form a complete group. In this example, the value of the last byte is hexadecimal FF. The first 6 bits are equal to decimal 63, which corresponds to the base-64 digit "/" at the end of the output, and the next 2 bits are padded with zeros to yield decimal 48, which corresponds to the base-64 digit, "w". The last two 6-bit values are padding and correspond to the valueless padding character, "=". :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBase64String/tb64s.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBase64String/tb64s.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBase64String/tb64s.vb" id="Snippet1"::: ]]> is . or is negative. -or- plus is greater than the length of . is not a valid value. System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to an equivalent Boolean value. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean The Boolean value to return. Returns the specified Boolean value; no actual conversion is performed. is returned unchanged. To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to an equivalent Boolean value. if is not zero; otherwise, . values to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/toboolean2.vb" id="Snippet12"::: ]]> Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean The Unicode character to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. value to a Boolean type throws . :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet20"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet20"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet20"::: ]]> This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean The number to convert. Converts the value of the specified decimal number to an equivalent Boolean value. if is not zero; otherwise, . values to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/toboolean2.vb" id="Snippet2"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to an equivalent Boolean value. if is not zero; otherwise, . and a to a Boolean value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to an equivalent Boolean value. if is not zero; otherwise, . values to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/toboolean2.vb" id="Snippet3"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to an equivalent Boolean value. if is not zero; otherwise, . values to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/toboolean2.vb" id="Snippet4"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to an equivalent Boolean value. if is not zero; otherwise, . values to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/toboolean2.vb" id="Snippet5"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] [<System.Diagnostics.CodeAnalysis.NotNullWhen(true)>] An object that implements the interface, or . Converts the value of a specified object to an equivalent Boolean value. or , which reflects the value returned by invoking the method for the underlying type of . If is , the method returns . values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/toboolean2.vb" id="Snippet11"::: ]]> is a string that does not equal or . does not implement the interface. -or- The conversion of to a is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Boolean The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to an equivalent Boolean value. if is not zero; otherwise, . values to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/toboolean2.vb" id="Snippet6"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean The single-precision floating-point number to convert. Converts the value of the specified single-precision floating-point number to an equivalent Boolean value. if is not zero; otherwise, . values to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/toboolean2.vb" id="Snippet7"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] [<System.Diagnostics.CodeAnalysis.NotNullWhen(true)>] A string that contains the value of either or . Converts the specified string representation of a logical value to its Boolean equivalent. if equals , or if equals or . , a constant whose value is `True`, , a constant whose value is `False`, or it must be `null`. In comparing `value` with and , the method ignores case as well as leading and trailing white space. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example uses the method to convert various strings to Boolean values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/ToBoolean1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/ToBoolean1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/ToBoolean1.vb" id="Snippet1"::: ]]> is not equal to or . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Boolean The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to an equivalent Boolean value. if is not zero; otherwise, . values to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/toboolean2.vb" id="Snippet8"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Boolean The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to an equivalent Boolean value. if is not zero; otherwise, . values to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/toboolean2.vb" id="Snippet9"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Boolean The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to an equivalent Boolean value. if is not zero; otherwise, . values to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/toboolean2.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/toboolean2.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/toboolean2.vb" id="Snippet10"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] [<System.Diagnostics.CodeAnalysis.NotNullWhen(true)>] An object that implements the interface, or . An object that supplies culture-specific formatting information. Converts the value of the specified object to an equivalent Boolean value, using the specified culture-specific formatting information. or , which reflects the value returned by invoking the method for the underlying type of . If is , the method returns . interface. ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the method. This method returns `true` if any of the non-discarded array values are non-zero. The object determines how elements are discarded for this calculation. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/objectifp.vb" id="Snippet1"::: ]]> is a string that does not equal or . does not implement the interface. -or- The conversion of to a is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] [<System.Diagnostics.CodeAnalysis.NotNullWhen(true)>] A string that contains the value of either or . An object that supplies culture-specific formatting information. This parameter is ignored. Converts the specified string representation of a logical value to its Boolean equivalent, using the specified culture-specific formatting information. if equals , or if equals or . method instead. It returns a value that indicates whether the conversion succeeded or failed. ]]> is not equal to or . System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to an 8-bit unsigned integer. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte The Boolean value to convert. Converts the specified Boolean value to the equivalent 8-bit unsigned integer. The number 1 if is ; otherwise, 0. to values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte1.vb" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte The 8-bit unsigned integer to return. Returns the specified 8-bit unsigned integer; no actual conversion is performed. is returned unchanged. To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte The Unicode character to convert. Converts the value of the specified Unicode character to the equivalent 8-bit unsigned integer. An 8-bit unsigned integer that is equivalent to . object passed to it. In .NET, a object is a 16-bit value. This means that the method is suitable for returning the numeric codes of characters in the ASCII character range or in the Unicode C0 Controls and Basic Latin, and C1 Controls and Latin-1 Supplement ranges, from U+0000 to U+00FF. ## Examples The following example converts an array of values to values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte1.vb" id="Snippet2"::: ]]> represents a number that is greater than Byte.MaxValue. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte The number to convert. Converts the value of the specified decimal number to an equivalent 8-bit unsigned integer. , rounded to the nearest 8-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. value to a and a value to a . :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet18"::: ]]> is greater than Byte.MaxValue or less than Byte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to an equivalent 8-bit unsigned integer. , rounded to the nearest 8-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. value to a and a value to a . :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet2"::: ]]> is greater than Byte.MaxValue or less than Byte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to an equivalent 8-bit unsigned integer. An 8-bit unsigned integer that is equivalent to . values to values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte1.vb" id="Snippet3"::: ]]> is less than Byte.MinValue or greater than Byte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to an equivalent 8-bit unsigned integer. An 8-bit unsigned integer that is equivalent to . values to values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte1.vb" id="Snippet4"::: ]]> is less than Byte.MinValue or greater than Byte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to an equivalent 8-bit unsigned integer. An 8-bit unsigned integer that is equivalent to . values to values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte1.vb" id="Snippet5"::: ]]> is less than Byte.MinValue or greater than Byte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte An object that implements the interface, or . Converts the value of the specified object to an 8-bit unsigned integer. An 8-bit unsigned integer that is equivalent to , or zero if is . implementation of the underlying type of `value`. ## Examples The following example uses the method to convert an array of objects to values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte1.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte1.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte1.vb" id="Snippet6"::: ]]> is not in the property format for a value. does not implement . -or- Conversion from to the type is not supported. represents a number that is less than Byte.MinValue or greater than Byte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Byte The 8-bit signed integer to be converted. Converts the value of the specified 8-bit signed integer to an equivalent 8-bit unsigned integer. An 8-bit unsigned integer that is equivalent to . values to values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte1.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte1.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte1.vb" id="Snippet7"::: ]]> is less than Byte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte A single-precision floating-point number. Converts the value of the specified single-precision floating-point number to an equivalent 8-bit unsigned integer. , rounded to the nearest 8-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. value to a . :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet19"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet19"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet19"::: ]]> is greater than Byte.MaxValue or less than Byte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte A string that contains the number to convert. Converts the specified string representation of a number to an equivalent 8-bit unsigned integer. An 8-bit unsigned integer that is equivalent to , or zero if is . method is equivalent to passing `value` to the method. `value` is interpreted by using the formatting conventions of the current culture. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example defines a string array and attempts to convert each string to a . Note that while a `null` string parses to zero, throws a . Also note that while leading and trailing spaces parse successfully, formatting symbols, such as currency symbols, group separators, or decimal separators, do not. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/ToByte5.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/ToByte5.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte5.vb" id="Snippet15"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than Byte.MinValue or greater than Byte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Byte The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to an equivalent 8-bit unsigned integer. An 8-bit unsigned integer that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte1.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte1.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte1.vb" id="Snippet8"::: ]]> is greater than Byte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Byte The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to an equivalent 8-bit unsigned integer. An 8-bit unsigned integer that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte1.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte1.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte1.vb" id="Snippet9"::: ]]> is greater than Byte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Byte The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to an equivalent 8-bit unsigned integer. An 8-bit unsigned integer that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte1.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte1.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte1.vb" id="Snippet10"::: ]]> is greater than Byte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to an 8-bit unsigned integer, using the specified culture-specific formatting information. An 8-bit unsigned integer that is equivalent to , or zero if is . interface. ## Examples The following example defines a `ByteString` class that implements the interface. The class stores the string representation of a byte value along with a sign field, so that it is able to represent both signed and unsigned byte values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte3.cs" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte3.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte3.vb" id="Snippet12"::: The following example instantiates several `ByteString` objects and calls the method to convert them to byte values. It illustrates that the method wraps a call to the method of the object to be converted. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte3.cs" id="Snippet13"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte3.fs" id="Snippet13"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte3.vb" id="Snippet13"::: ]]> is not in the property format for a value. does not implement . -or- Conversion from to the type is not supported. represents a number that is less than Byte.MinValue or greater than Byte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte A string that contains the number to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent 8-bit unsigned integer, using specified culture-specific formatting information. An 8-bit unsigned integer that is equivalent to , or zero if is . instance that obtains a object. The object provides culture-specific information about the format of `value`. If `provider` is `null`, the object for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example creates a custom object that defines the positive sign as "pos" and the negative sign as "neg", which it uses in calls to the method. It then calls the method repeatedly to convert each element in a string array to a value. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte4.cs" id="Snippet14"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte4.fs" id="Snippet14"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte4.vb" id="Snippet14"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than Byte.MinValue or greater than Byte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Byte A string that contains the number to convert. The base of the number in , which must be 2, 8, 10, or 16. Converts the string representation of a number in a specified base to an equivalent 8-bit unsigned integer. An 8-bit unsigned integer that is equivalent to the number in , or 0 (zero) if is . data type supports unsigned values only, the method assumes that `value` is expressed using unsigned binary representation. In other words, all eight bits are used to represent the numeric value, and a sign bit is absent. As a result, it is possible to write code in which a signed byte value that is out of the range of the data type is converted to a value without the method throwing an exception. The following example converts to its hexadecimal string representation, and then calls the method. Instead of throwing an exception, the method displays the message, "0x80 converts to 128." :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet3"::: When performing binary operations or numeric conversions, it is always the responsibility of the developer to verify that a method or operator is using the appropriate numeric representation to interpret a particular value. The following example illustrates one technique for ensuring that the method does not inappropriately use unsigned binary representation when it converts a hexadecimal string representation to a value. The example determines whether a value represents a signed or an unsigned integer while it is converting that value to its string representation. When the example converts the value back to a value, it checks whether the original value was a signed integer. If so, and if its high-order bit is set (which indicates that the value is negative and that it uses two's complement instead of unsigned binary representation), the method throws an exception. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet4"::: ## Examples The following example alternately attempts to interpret an array of strings as the representation of binary, octal, decimal, and hexadecimal values. :::code language="csharp" source="~/snippets/csharp/System/Byte/Overview/tobyte2.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Byte/Overview/tobyte2.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/tobyte2.vb" id="Snippet11"::: ]]> is not 2, 8, 10, or 16. -or- , which represents a non-base 10 unsigned number, is prefixed with a negative sign. is . contains a character that is not a valid digit in the base specified by . The exception message indicates that there are no digits to convert if the first character in is invalid; otherwise, the message indicates that contains invalid trailing characters. , which represents a base 10 unsigned number, is prefixed with a negative sign. -or- represents a number that is less than Byte.MinValue or greater than Byte.MaxValue. mscorlib 2.0.5.0 4.0.0.0 Converts a specified value to a Unicode character. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char The Boolean value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to its equivalent Unicode character. A Unicode character that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToChar/tochar1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToChar/tochar1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToChar/tochar1.vb" id="Snippet1"::: ]]> Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char The Unicode character to return. Returns the specified Unicode character value; no actual conversion is performed. is returned unchanged. To be added. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char The decimal number to convert. Calling this method always throws . This conversion is not supported. No value is returned. to , and throws on failure. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet17"::: ]]> This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char The double-precision floating-point number to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to its equivalent Unicode character. A Unicode character that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToChar/tochar1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToChar/tochar1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToChar/tochar1.vb" id="Snippet2"::: ]]> is less than Char.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to its equivalent Unicode character. A Unicode character that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToChar/tochar1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToChar/tochar1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToChar/tochar1.vb" id="Snippet3"::: ]]> is less than Char.MinValue or greater than Char.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to its equivalent Unicode character. A Unicode character that is equivalent to . , and throws a on failure. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet8"::: ]]> is less than Char.MinValue or greater than Char.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char An object that implements the interface. Converts the value of the specified object to a Unicode character. A Unicode character that is equivalent to value, or Char.MinValue if is . implementation of the underlying type of `value`. ## Examples The following example attempts to convert each element in an object array to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToChar/tochar1.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToChar/tochar1.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToChar/tochar1.vb" id="Snippet9"::: ]]> is a null string. does not implement the interface. -or- The conversion of to a is not supported. is less than Char.MinValue or greater than Char.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Char The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to its equivalent Unicode character. A Unicode character that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToChar/tochar1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToChar/tochar1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToChar/tochar1.vb" id="Snippet4"::: ]]> is less than Char.MinValue. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char The single-precision floating-point number to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char A string of length 1. Converts the first character of a specified string to a Unicode character. A Unicode character that is equivalent to the first and only character in . method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example converts each element in a string array to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToChar/tochar1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToChar/tochar1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToChar/tochar1.vb" id="Snippet5"::: ]]> is . The length of is not 1. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Char The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to its equivalent Unicode character. A Unicode character that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToChar/tochar1.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToChar/tochar1.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToChar/tochar1.vb" id="Snippet6"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Char The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to its equivalent Unicode character. A Unicode character that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToChar/tochar1.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToChar/tochar1.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToChar/tochar1.vb" id="Snippet7"::: ]]> is greater than Char.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Char The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to its equivalent Unicode character. A Unicode character that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToChar/tochar1.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToChar/tochar1.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToChar/tochar1.vb" id="Snippet8"::: ]]> is greater than Char.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to its equivalent Unicode character, using the specified culture-specific formatting information. A Unicode character that is equivalent to , or Char.MinValue if is . method of the underlying type of `value`. `provider` enables the user to specify culture-specific conversion information about the contents of `value`. The base types ignore `provider`; however, the parameter may be used if `value` is a user-defined type that implements the interface. ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the `ToChar` method. This method returns a character whose Unicode value is the average of the array of values, using the object that implements to determine how to calculate the average. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/objectifp.vb" id="Snippet1"::: ]]> is a null string. does not implement the interface. -or- The conversion of to a is not supported. is less than Char.MinValue or greater than Char.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Char [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] A string of length 1 or . An object that supplies culture-specific formatting information. This parameter is ignored. Converts the first character of a specified string to a Unicode character, using specified culture-specific formatting information. A Unicode character that is equivalent to the first and only character in . method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example converts a string representation of a value with the `ToChar` method, using an object that displays the type of the format provider for which it is called. The example shows that the format provider is not referenced. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToChar/stringnonnum.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToChar/stringnonnum.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToChar/stringnonnum.vb" id="Snippet2"::: ]]> is . The length of is not 1. mscorlib 2.0.5.0 4.0.0.0 Converts a specified value to a value. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime The Boolean value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime The 8-bit unsigned integer to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime The Unicode character to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime A date and time value. Returns the specified object; no actual conversion is performed. is returned unchanged. To be added. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime The number to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime The double-precision floating-point value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime The 16-bit signed integer to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime The 32-bit signed integer to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime The 64-bit signed integer to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime An object that implements the interface, or . Converts the value of the specified object to a object. The date and time equivalent of the value of , or a date and time equivalent of DateTime.MinValue if is . or a , or `value` must be `null`. Otherwise, the method throws an . In addition, if `value` is a string, it must contain a valid representation of a date and time value in the current culture or a is thrown. The return value is the result of invoking the method of the underlying type of `value`. ## Examples The following example calls the method with a variety of variables. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDateTime/ToDateTime1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDateTime/ToDateTime1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDateTime/ToDateTime1.vb" id="Snippet1"::: ]]> is not a valid date and time value. does not implement the interface. -or- The conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.DateTime The 8-bit signed integer to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime The single-precision floating-point value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime The string representation of a date and time. Converts the specified string representation of a date and time to an equivalent date and time value. The date and time equivalent of the value of , or the date and time equivalent of DateTime.MinValue if is . method on `value` using the formatting information in a object that is initialized for the current culture. The `value` argument must contain the representation of a date and time in one of the formats described in the topic. If `value` is `null`, the method returns . This method tries to parse `value` completely and avoid throwing a . It completes missing month, day, and year information with the current date. If `value` contains only a date and no time, this method assumes a time of midnight. Any leading, inner, or trailing white-space characters in `value` are ignored. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example uses the method to convert various string representations of dates and times to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDateTime/ToDateTime2.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDateTime/ToDateTime2.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDateTime/ToDateTime2.vb" id="Snippet2"::: ]]> is not a properly formatted date and time string. Parsing Date and Time Strings in .NET Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.DateTime The 16-bit unsigned integer to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.DateTime The 32-bit unsigned integer to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.DateTime The 64-bit unsigned integer to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to a object, using the specified culture-specific formatting information. The date and time equivalent of the value of , or the date and time equivalent of DateTime.MinValue if is . method of the underlying type of `value`. `provider` enables the user to specify culture-specific conversion information about the contents of `value`. For example, if `value` is a that represents a date, `provider` could supply culture-specific information about the notation used to represent that date. `provider` is involved in the conversion of `value` if the runtime type of `value` is a , or if `value` is a user-defined type whose implementation makes use of `provider`. If the runtime type of `value` is and `provider` is `null`, the object that represents the current culture is used. ## Examples The following example defines a custom format provider, `CustomProvider`, whose method outputs a message to the console that it has been invoked, and then returns the object of the culture whose name was passed as a parameter to its class constructor. Each of these `CustomProvider` objects is used to convert the elements in an object array to date and time values. The output indicates that the `CustomProvider` object is used in the conversion only when the type of the `value` parameter is a . :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDateTime/todatetime4.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDateTime/todatetime4.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDateTime/todatetime4.vb" id="Snippet4"::: ]]> is not a valid date and time value. does not implement the interface. -or- The conversion is not supported. Parsing Date and Time Strings in .NET Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.DateTime A string that contains a date and time to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent date and time, using the specified culture-specific formatting information. The date and time equivalent of the value of , or the date and time equivalent of DateTime.MinValue if is . method on `value`. `provider` is an instance that obtains a object. The object provides culture-specific information about the format of `value`. If `provider` is `null`, the for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example converts string representations of date values with the `ToDateTime` method, using an object. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDateTime/ToDateTime3.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDateTime/ToDateTime3.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDateTime/ToDateTime3.vb" id="Snippet3"::: ]]> is not a properly formatted date and time string. Parsing Date and Time Strings in .NET System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to a decimal number. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal The Boolean value to convert. Converts the specified Boolean value to the equivalent decimal number. The number 1 if is ; otherwise, 0. to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal11.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal11.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal11.vb" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to the equivalent decimal number. The decimal number that is equivalent to . value to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet18"::: ]]> Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal The Unicode character to convert. Calling this method always throws . This conversion is not supported. No value is returned. value to , and throws upon failure. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet17"::: ]]> This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal A decimal number. Returns the specified decimal number; no actual conversion is performed. is returned unchanged. To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to an equivalent decimal number. A decimal number that is equivalent to . value returned by this method contains a maximum of 15 significant digits. If the `value` parameter contains more than 15 significant digits, it is rounded using rounding to nearest. The following example illustrates how the method uses rounding to nearest to return a value with 15 significant digits. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/ToDecimal1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/ToDecimal1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/ToDecimal1.vb" id="Snippet2"::: ## Examples The following example converts a value to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet5"::: ]]> is greater than Decimal.MaxValue or less than Decimal.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to an equivalent decimal number. A decimal number that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal11.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal11.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal11.vb" id="Snippet2"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to an equivalent decimal number. A decimal number that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal11.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal11.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal11.vb" id="Snippet3"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to an equivalent decimal number. A decimal number that is equivalent to . value to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet10"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal An object that implements the interface, or . Converts the value of the specified object to an equivalent decimal number. A decimal number that is equivalent to , or 0 (zero) if is . method of the underlying type of `value`. ## Examples The following example tries to convert each element in an object array to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal11.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal11.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal11.vb" id="Snippet4"::: ]]> is not in an appropriate format for a type. does not implement the interface. -or- The conversion is not supported. represents a number that is less than Decimal.MinValue or greater than Decimal.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Decimal The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to the equivalent decimal number. A decimal number that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal11.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal11.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal11.vb" id="Snippet5"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal The single-precision floating-point number to convert. Converts the value of the specified single-precision floating-point number to the equivalent decimal number. A decimal number that is equivalent to . value returned by this method contains a maximum of seven significant digits. If the `value` parameter contains more than seven significant digits, it is rounded using rounding to nearest. The following example illustrates how the method uses rounding to nearest to return a value with seven significant digits. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/ToDecimal1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/ToDecimal1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/ToDecimal1.vb" id="Snippet1"::: ## Examples The following example tries to convert each element in an array of values to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal11.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal11.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal11.vb" id="Snippet6"::: ]]> is greater than Decimal.MaxValue or less than Decimal.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal A string that contains a number to convert. Converts the specified string representation of a number to an equivalent decimal number. A decimal number that is equivalent to the number in , or 0 (zero) if is . method is equivalent to passing `value` to the method. `value` is interpreted by using the formatting conventions of the current culture. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example illustrates the use of `ToDecimal`. It attempts to convert a to a , and throws the possible exceptions that may arise during the conversion. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet15"::: ]]> is not a number in a valid format. represents a number that is less than Decimal.MinValue or greater than Decimal.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Decimal The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to an equivalent decimal number. The decimal number that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal11.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal11.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal11.vb" id="Snippet7"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Decimal The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to an equivalent decimal number. A decimal number that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal11.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal11.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal11.vb" id="Snippet8"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Decimal The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to an equivalent decimal number. A decimal number that is equivalent to . values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal11.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal11.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal11.vb" id="Snippet9"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to an equivalent decimal number, using the specified culture-specific formatting information. A decimal number that is equivalent to , or 0 (zero) if is . method of the underlying type of `value`. `provider` enables the user to specify culture-specific conversion information about the contents of `value`. The base types ignore `provider`; however, the parameter may be used if `value` is a user-defined type that implements the interface. ## Examples The following example defines a `Temperature` class that implements the interface. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal2.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal2.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal2.vb" id="Snippet10"::: The following example shows that when a `Temperature` object is passed as a parameter to the method, the implementation of the `Temperature` class is called to perform the conversion. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal2.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal2.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal2.vb" id="Snippet11"::: ]]> is not in an appropriate format for a type. does not implement the interface. -or- The conversion is not supported. represents a number that is less than Decimal.MinValue or greater than Decimal.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Decimal A string that contains a number to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent decimal number, using the specified culture-specific formatting information. A decimal number that is equivalent to the number in , or 0 (zero) if is . method on `value`. `provider` is an instance that obtains a object. The object provides culture-specific information about the format of `value`. If `provider` is `null`, the for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example attempts to convert an array of strings to values by using objects that represent two different cultures. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDecimal/todecimal3.cs" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDecimal/todecimal3.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDecimal/todecimal3.vb" id="Snippet12"::: ]]> is not a number in a valid format. represents a number that is less than Decimal.MinValue or greater than Decimal.MaxValue. System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to a double-precision floating-point number. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double The Boolean value to convert. Converts the specified Boolean value to the equivalent double-precision floating-point number. The number 1 if is ; otherwise, 0. value to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to the equivalent double-precision floating-point number. The double-precision floating-point number that is equivalent to . value to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet2"::: ]]> Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double The Unicode character to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double The decimal number to convert. Converts the value of the specified decimal number to an equivalent double-precision floating-point number. A double-precision floating-point number that is equivalent to . value to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet5"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double The double-precision floating-point number to return. Returns the specified double-precision floating-point number; no actual conversion is performed. is returned unchanged. To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to an equivalent double-precision floating-point number. A double-precision floating-point number equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDouble/todouble1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDouble/todouble1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDouble/todouble1.vb" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to an equivalent double-precision floating-point number. A double-precision floating-point number that is equivalent to . value to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet3"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to an equivalent double-precision floating-point number. A double-precision floating-point number that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDouble/todouble1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDouble/todouble1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDouble/todouble1.vb" id="Snippet2"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double An object that implements the interface, or . Converts the value of the specified object to a double-precision floating-point number. A double-precision floating-point number that is equivalent to , or zero if is . implementation of the underlying type of `value`. ## Examples The following example attempts to convert each value in an object array to a . :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDouble/todouble1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDouble/todouble1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDouble/todouble1.vb" id="Snippet3"::: ]]> is not in an appropriate format for a type. does not implement the interface. -or- The conversion is not supported. represents a number that is less than Double.MinValue or greater than Double.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Double The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to the equivalent double-precision floating-point number. The 8-bit signed integer that is equivalent to . values to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDouble/todouble1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDouble/todouble1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDouble/todouble1.vb" id="Snippet4"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double The single-precision floating-point number. Converts the value of the specified single-precision floating-point number to an equivalent double-precision floating-point number. A double-precision floating-point number that is equivalent to . value to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet6"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double A string that contains the number to convert. Converts the specified string representation of a number to an equivalent double-precision floating-point number. A double-precision floating-point number that is equivalent to the number in , or 0 (zero) if is . method is equivalent to passing `value` to the method. `value` is interpreted by using the formatting conventions of the current culture. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example attempts to convert each element in an array of numeric strings to a . The example's output is from a system whose current culture is en-US. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDouble/example8.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDouble/example8.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDouble/example8.vb" id="Snippet8"::: ]]> is not a number in a valid format. represents a number that is less than Double.MinValue or greater than Double.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Double The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to the equivalent double-precision floating-point number. A double-precision floating-point number that is equivalent to . values to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDouble/todouble1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDouble/todouble1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDouble/todouble1.vb" id="Snippet5"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Double The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to an equivalent double-precision floating-point number. A double-precision floating-point number that is equivalent to . values to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDouble/todouble1.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDouble/todouble1.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDouble/todouble1.vb" id="Snippet6"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Double The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to an equivalent double-precision floating-point number. A double-precision floating-point number that is equivalent to . values to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDouble/todouble1.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDouble/todouble1.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDouble/todouble1.vb" id="Snippet7"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to an double-precision floating-point number, using the specified culture-specific formatting information. A double-precision floating-point number that is equivalent to , or zero if is . method of the underlying type of `value`. `provider` enables the user to specify culture-specific conversion information about the contents of `value`. For example, if `value` is a that represents a number, `provider` could supply culture-specific information about the notation used to represent that number. The base types ignore `provider`; however, the parameter may be used if `value` is a user-defined type that implements the interface. ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the `ToDouble` method. This method returns an average of the array of values, using the object that implements to determine how to calculate the average. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/objectifp.vb" id="Snippet1"::: ]]> is not in an appropriate format for a type. does not implement the interface. represents a number that is less than Double.MinValue or greater than Double.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Double A string that contains the number to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent double-precision floating-point number, using the specified culture-specific formatting information. A double-precision floating-point number that is equivalent to the number in , or 0 (zero) if is . method on `value`. `provider` is an instance that obtains a object. The object provides culture-specific information about the format of `value`. If `provider` is `null`, the for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example converts string representations of values with the `ToDouble` method, using an object. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToDouble/todouble.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToDouble/todouble.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToDouble/todouble.vb" id="Snippet2"::: ]]> is not a number in a valid format. represents a number that is less than Double.MinValue or greater than Double.MaxValue. Method System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.String An array of 8-bit unsigned integers. Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with uppercase hex characters. The string representation in hex of the elements in . To be added. is . is too large to be encoded. Method System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.String [System.Runtime.CompilerServices.Nullable(1)] [<System.Runtime.CompilerServices.Nullable(1)>] A span of 8-bit unsigned integers. Converts a span of 8-bit unsigned integers to its equivalent string representation that is encoded with uppercase hex characters. The string representation in hex of the elements in . To be added. is too large to be encoded. Method System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.String An array of 8-bit unsigned integers. An offset in . The number of elements of to convert. Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with uppercase hex characters. Parameters specify the subset as an offset in the input array and the number of elements in the array to convert. The string representation in hex of elements of , starting at position . To be added. is . or is negative. plus is greater than the length of . is too large to be encoded. Method System.Runtime 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.String An array of 8-bit unsigned integers. Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with lowercase hex characters. The string representation in hex of the elements in . To be added. is null. is too large to be encoded. Method System.Runtime 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.String [System.Runtime.CompilerServices.Nullable(1)] [<System.Runtime.CompilerServices.Nullable(1)>] A span of 8-bit unsigned integers. Converts a span of 8-bit unsigned integers to its equivalent string representation that is encoded with lowercase hex characters. The string representation in hex of the elements in . To be added. is too large to be encoded. Method System.Runtime 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.String An array of 8-bit unsigned integers. An offset in . The number of elements of to convert. Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with lowercase hex characters. Parameters specify the subset as an offset in the input array and the number of elements in the array to convert. The string representation in hex of elements of , starting at position . To be added. is null. or is negative. -or- + is greater than the length of . -or- is too large to be encoded. System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to a 16-bit signed integer. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 The Boolean value to convert. Converts the specified Boolean value to the equivalent 16-bit signed integer. The number 1 if is ; otherwise, 0. values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16_1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16_1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/toint16_1.vb" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to the equivalent 16-bit signed integer. A 16-bit signed integer that is equivalent to . values to a 16-bit signed integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16_1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16_1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/toint16_1.vb" id="Snippet2"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 The Unicode character to convert. Converts the value of the specified Unicode character to the equivalent 16-bit signed integer. A 16-bit signed integer that is equivalent to . values to a 16-bit signed integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16_1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16_1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/toint16_1.vb" id="Snippet3"::: ]]> is greater than Int16.MaxValue. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 The decimal number to convert. Converts the value of the specified decimal number to an equivalent 16-bit signed integer. , rounded to the nearest 16-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to a 16-bit signed integer. The example illustrates that any fractional part of a value is rounded when performing the conversion. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16_1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16_1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/toint16_1.vb" id="Snippet4"::: ]]> is greater than Int16.MaxValue or less than Int16.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to an equivalent 16-bit signed integer. , rounded to the nearest 16-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to a 16-bit signed integer. The example illustrates that any fractional part of a value is rounded before performing the conversion. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16_1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16_1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/toint16_1.vb" id="Snippet5"::: ]]> is greater than Int16.MaxValue or less than Int16.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 The 16-bit signed integer to return. Returns the specified 16-bit signed integer; no actual conversion is performed. is returned unchanged. To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to an equivalent 16-bit signed integer. The 16-bit signed integer equivalent of . is greater than Int16.MaxValue or less than Int16.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to an equivalent 16-bit signed integer. A 16-bit signed integer that is equivalent to . is greater than Int16.MaxValue or less than Int16.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 An object that implements the interface, or . Converts the value of the specified object to a 16-bit signed integer. A 16-bit signed integer that is equivalent to , or zero if is . implementation of the underlying type of `value`. ## Examples The following example attempts to convert each element in an object array to a 16-bit signed integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16_1.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16_1.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/toint16_1.vb" id="Snippet8"::: ]]> is not in an appropriate format for an type. does not implement the interface. -or- The conversion is not supported. represents a number that is less than Int16.MinValue or greater than Int16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int16 The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to the equivalent 16-bit signed integer. A 8-bit signed integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 The single-precision floating-point number to convert. Converts the value of the specified single-precision floating-point number to an equivalent 16-bit signed integer. , rounded to the nearest 16-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to a 16-bit signed integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16_1.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16_1.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/toint16_1.vb" id="Snippet10"::: ]]> is greater than Int16.MaxValue or less than Int16.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 A string that contains the number to convert. Converts the specified string representation of a number to an equivalent 16-bit signed integer. A 16-bit signed integer that is equivalent to the number in , or 0 (zero) if is . method is equivalent to passing `value` to the method. `value` is interpreted by using the formatting conventions of the current culture. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example converts string representations of 16-bit integers with the `ToInt16` method, using default formatting. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/toint16.vb" id="Snippet3"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than Int16.MinValue or greater than Int16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int16 The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to the equivalent 16-bit signed integer. A 16-bit signed integer that is equivalent to . is greater than Int16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int16 The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to an equivalent 16-bit signed integer. A 16-bit signed integer that is equivalent to . is greater than Int16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int16 The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to an equivalent 16-bit signed integer. A 16-bit signed integer that is equivalent to . is greater than Int16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to a 16-bit signed integer, using the specified culture-specific formatting information. A 16-bit signed integer that is equivalent to , or zero if is . that represents a number, `provider` could supply culture-specific information about the notation used to represent that number. The base types ignore `provider`; however, the parameter may be used if `value` is a user-defined type that implements the interface. ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the `ToInt16` method. This method returns an average of the array of values, using the object that implements to determine how to calculate the average. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/objectifp.vb" id="Snippet1"::: ]]> is not in an appropriate format for an type. does not implement . represents a number that is less than Int16.MinValue or greater than Int16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 A string that contains the number to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent 16-bit signed integer, using the specified culture-specific formatting information. A 16-bit signed integer that is equivalent to the number in , or 0 (zero) if is . instance that obtains a object. The object provides culture-specific information about the format of `value`. If `provider` is `null`, the for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example converts string representations of 16-bit integers with the `ToInt16` method, using an object. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/toint16.vb" id="Snippet3"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than Int16.MinValue or greater than Int16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int16 A string that contains the number to convert. The base of the number in , which must be 2, 8, 10, or 16. Converts the string representation of a number in a specified base to an equivalent 16-bit signed integer. A 16-bit signed integer that is equivalent to the number in , or 0 (zero) if is . method assumes that negative numbers use two's complement representation. In other words, the method always interprets the highest-order binary bit of an integer (bit 15) as its sign bit. As a result, it is possible to write code in which a non-base 10 number that is out of the range of the data type is converted to an value without the method throwing an exception. The following example increments by one, converts the resulting number to its hexadecimal string representation, and then calls the method. Instead of throwing an exception, the method displays the message, "0x8000 converts to -32768." :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet5"::: When performing binary operations or numeric conversions, it is always the responsibility of the developer to verify that a method is using the appropriate numeric representation to interpret a particular value. As the following example illustrates, you can ensure that the method handles overflows appropriately by first retrieving the sign of the numeric value before converting it to its hexadecimal string representation. Throw an exception if the original value was positive but the conversion back to an integer yields a negative value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet6"::: ## Examples The following example attempts to interpret each element in a string array as a hexadecimal string and to convert it to a 16-bit signed integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/toint16_2.cs" id="Snippet14"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/toint16_2.fs" id="Snippet14"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/toint16_2.vb" id="Snippet14"::: ]]> is not 2, 8, 10, or 16. -or- , which represents a non-base 10 signed number, is prefixed with a negative sign. is . contains a character that is not a valid digit in the base specified by . The exception message indicates that there are no digits to convert if the first character in is invalid; otherwise, the message indicates that contains invalid trailing characters. , which represents a non-base 10 signed number, is prefixed with a negative sign. -or- represents a number that is less than Int16.MinValue or greater than Int16.MaxValue. System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to a 32-bit signed integer. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 The Boolean value to convert. Converts the specified Boolean value to the equivalent 32-bit signed integer. The number 1 if is ; otherwise, 0. values `true` and `false` to integers. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt32/toint32_1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt32/toint32_1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt32/toint32_1.vb" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to the equivalent 32-bit signed integer. A 32-bit signed integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 The Unicode character to convert. Converts the value of the specified Unicode character to the equivalent 32-bit signed integer. A 32-bit signed integer that is equivalent to . method returns a 32-bit signed integer that represents the UTF-16 encoded code unit of the `value` argument. If `value` is not a low surrogate or a high surrogate, this return value also represents the Unicode code point of value. ## Examples The following example converts each element in an array of values to an integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt32/toint32_1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt32/toint32_1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt32/toint32_1.vb" id="Snippet3"::: ]]> Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Security.SecuritySafeCritical] [<System.Security.SecuritySafeCritical>] System.Int32 The decimal number to convert. Converts the value of the specified decimal number to an equivalent 32-bit signed integer. , rounded to the nearest 32-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt32/toint32_1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt32/toint32_1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt32/toint32_1.vb" id="Snippet4"::: ]]> is greater than Int32.MaxValue or less than Int32.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to an equivalent 32-bit signed integer. , rounded to the nearest 32-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt32/toint32_1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt32/toint32_1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt32/toint32_1.vb" id="Snippet5"::: ]]> is greater than Int32.MaxValue or less than Int32.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to an equivalent 32-bit signed integer. A 32-bit signed integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 The 32-bit signed integer to return. Returns the specified 32-bit signed integer; no actual conversion is performed. is returned unchanged. To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to an equivalent 32-bit signed integer. A 32-bit signed integer that is equivalent to . is greater than Int32.MaxValue or less than Int32.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 An object that implements the interface, or . Converts the value of the specified object to a 32-bit signed integer. A 32-bit signed integer equivalent to , or zero if is . implementation of the underlying type of `value`. ## Examples The following example attempts to convert each element in an object array to an integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt32/toint32_1.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt32/toint32_1.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt32/toint32_1.vb" id="Snippet8"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than Int32.MinValue or greater than Int32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int32 The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to the equivalent 32-bit signed integer. A 8-bit signed integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 The single-precision floating-point number to convert. Converts the value of the specified single-precision floating-point number to an equivalent 32-bit signed integer. , rounded to the nearest 32-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt32/toint32_1.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt32/toint32_1.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt32/toint32_1.vb" id="Snippet10"::: ]]> is greater than Int32.MaxValue or less than Int32.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 A string that contains the number to convert. Converts the specified string representation of a number to an equivalent 32-bit signed integer. A 32-bit signed integer that is equivalent to the number in , or 0 (zero) if is . method is equivalent to passing `value` to the method.`value` is interpreted by using the formatting conventions of the current culture. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example attempts to convert each element in a numeric string array to an integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt32/toint32_1.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt32/toint32_1.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt32/toint32_1.vb" id="Snippet11"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than Int32.MinValue or greater than Int32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int32 The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to the equivalent 32-bit signed integer. A 32-bit signed integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int32 The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to an equivalent 32-bit signed integer. A 32-bit signed integer that is equivalent to . is greater than Int32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int32 The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to an equivalent 32-bit signed integer. A 32-bit signed integer that is equivalent to . is greater than Int32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to a 32-bit signed integer, using the specified culture-specific formatting information. A 32-bit signed integer that is equivalent to , or zero if is . method of the underlying type of `value`. `provider` enables the user to specify culture-specific conversion information about the contents of `value`. For example, if `value` is a that represents a number, `provider` could supply culture-specific information about the notation used to represent that number. The base types ignore `provider`; however, the parameter may be used if `value` is a user-defined type that implements the interface. ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the `ToInt32` method. This method returns an average of the array of values, using the object that implements to determine how to calculate the average. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/objectifp.vb" id="Snippet1"::: ]]> is not in an appropriate format. does not implement . represents a number that is less than Int32.MinValue or greater than Int32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 A string that contains the number to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent 32-bit signed integer, using the specified culture-specific formatting information. A 32-bit signed integer that is equivalent to the number in , or 0 (zero) if is . method on `value`. `provider` is an instance that obtains a object. The object provides culture-specific information about the format of `value`. If `provider` is `null`, the for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example defines a custom object that recognizes the string "pos" as the positive sign and the string "neg" as the negative sign. It then attempts to convert each element of a numeric string array to an integer using both this provider and the provider for the invariant culture. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt32/toint32_2.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt32/toint32_2.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt32/toint32_2.vb" id="Snippet15"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than Int32.MinValue or greater than Int32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int32 A string that contains the number to convert. The base of the number in , which must be 2, 8, 10, or 16. Converts the string representation of a number in a specified base to an equivalent 32-bit signed integer. A 32-bit signed integer that is equivalent to the number in , or 0 (zero) if is . method assumes that negative numbers use two's complement representation. In other words, the method always interprets the highest-order binary bit of an integer (bit 31) as its sign bit. As a result, it is possible to write code in which a non-base 10 number that is out of the range of the data type is converted to an value without the method throwing an exception. The following example increments by one, converts the resulting number to its hexadecimal string representation, and then calls the method. Instead of throwing an exception, the method displays the message, "0x80000000 converts to -2147483648." :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet1"::: When performing binary operations or numeric conversions, it is always the responsibility of the developer to verify that a method is using the appropriate numeric representation to interpret a particular value. As the following example illustrates, you can ensure that the method handles overflows appropriately by first retrieving the sign of the numeric value before converting it to its hexadecimal string representation. Throw an exception if the original value was positive but the conversion back to an integer yields a negative value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet2"::: ]]> is not 2, 8, 10, or 16. -or- , which represents a non-base 10 signed number, is prefixed with a negative sign. is . contains a character that is not a valid digit in the base specified by . The exception message indicates that there are no digits to convert if the first character in is invalid; otherwise, the message indicates that contains invalid trailing characters. , which represents a non-base 10 signed number, is prefixed with a negative sign. -or- represents a number that is less than Int32.MinValue or greater than Int32.MaxValue. System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to a 64-bit signed integer. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 The Boolean value to convert. Converts the specified Boolean value to the equivalent 64-bit signed integer. The number 1 if is ; otherwise, 0. values `true` and `false` to long integers. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt64/toint64_1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt64/toint64_1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt64/toint64_1.vb" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to the equivalent 64-bit signed integer. A 64-bit signed integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 The Unicode character to convert. Converts the value of the specified Unicode character to the equivalent 64-bit signed integer. A 64-bit signed integer that is equivalent to . array to a long integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt64/toint64_1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt64/toint64_1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt64/toint64_1.vb" id="Snippet3"::: ]]> Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 The decimal number to convert. Converts the value of the specified decimal number to an equivalent 64-bit signed integer. , rounded to the nearest 64-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to a long integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt64/toint64_1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt64/toint64_1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt64/toint64_1.vb" id="Snippet4"::: ]]> is greater than Int64.MaxValue or less than Int64.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Security.SecuritySafeCritical] [<System.Security.SecuritySafeCritical>] System.Int64 The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to an equivalent 64-bit signed integer. , rounded to the nearest 64-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to a long integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt64/toint64_1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt64/toint64_1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt64/toint64_1.vb" id="Snippet5"::: ]]> is greater than Int64.MaxValue or less than Int64.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to an equivalent 64-bit signed integer. A 64-bit signed integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to an equivalent 64-bit signed integer. A 64-bit signed integer that is equivalent to . To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 A 64-bit signed integer. Returns the specified 64-bit signed integer; no actual conversion is performed. is returned unchanged. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 An object that implements the interface, or . Converts the value of the specified object to a 64-bit signed integer. A 64-bit signed integer that is equivalent to , or zero if is . implementation of the underlying type of `value`. ## Examples The following example attempts to convert each element in an object array to a long integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt64/toint64_1.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt64/toint64_1.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt64/toint64_1.vb" id="Snippet8"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than Int64.MinValue or greater than Int64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int64 The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to the equivalent 64-bit signed integer. A 64-bit signed integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 The single-precision floating-point number to convert. Converts the value of the specified single-precision floating-point number to an equivalent 64-bit signed integer. , rounded to the nearest 64-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to a long integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt64/toint64_1.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt64/toint64_1.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt64/toint64_1.vb" id="Snippet10"::: ]]> is greater than Int64.MaxValue or less than Int64.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 A string that contains a number to convert. Converts the specified string representation of a number to an equivalent 64-bit signed integer. A 64-bit signed integer that is equivalent to the number in , or 0 (zero) if is . method is equivalent to passing `value` to the method. `value` is interpreted by using the formatting conventions of the current culture. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example attempts to convert each element in an array of numeric strings to a long integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt64/toint64_1.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt64/toint64_1.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt64/toint64_1.vb" id="Snippet11"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than Int64.MinValue or greater than Int64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int64 The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to the equivalent 64-bit signed integer. A 64-bit signed integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int64 The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to an equivalent 64-bit signed integer. A 64-bit signed integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Int64 The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to an equivalent 64-bit signed integer. A 64-bit signed integer that is equivalent to . is greater than Int64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to a 64-bit signed integer, using the specified culture-specific formatting information. A 64-bit signed integer that is equivalent to , or zero if is . method of the underlying type of `value`. `provider` enables the user to specify culture-specific conversion information about the contents of `value`. For example, if `value` is a that represents a number, `provider` could supply culture-specific information about the notation used to represent that number. The base types ignore `provider`; however, the parameter may be used if `value` is a user-defined type that implements the interface. ## Examples The following example defines a class that implements and a class that implements . Objects of the class that implements hold an array of values. An object of each class is passed to the `ToInt64` method. This method returns an average of the array of values, using the object that implements to determine how to calculate the average. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/objectifp.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/objectifp.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/objectifp.vb" id="Snippet1"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than Int64.MinValue or greater than Int64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 A string that contains the number to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent 64-bit signed integer, using the specified culture-specific formatting information. A 64-bit signed integer that is equivalent to the number in , or 0 (zero) if is . method on `value`. `provider` is an `IFormatProvider` instance that obtains a object. The `NumberFormatInfo` object provides culture-specific information about the format of `value`. If `provider` is `null`, the `NumberFormatInfo` for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example defines a custom object that recognizes the string "pos" as the positive sign and the string "neg" as the negative sign. It then attempts to convert each element of a numeric string array to an integer using both this provider and the provider for the invariant culture. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt64/toint64_3.cs" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt64/toint64_3.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt64/toint64_3.vb" id="Snippet16"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than Int64.MinValue or greater than Int64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Int64 A string that contains the number to convert. The base of the number in , which must be 2, 8, 10, or 16. Converts the string representation of a number in a specified base to an equivalent 64-bit signed integer. A 64-bit signed integer that is equivalent to the number in , or 0 (zero) if is . method assumes that negative numbers use two's complement representation. In other words, the method always interprets the highest-order binary bit of a long integer (bit 63) as its sign bit. As a result, it is possible to write code in which a non-base 10 number that is out of the range of the data type is converted to an value without the method throwing an exception. The following example converts to its hexadecimal string representation, and then calls the method. Instead of throwing an exception, the method displays the message, "0xFFFFFFFFFFFFFFFF converts to -1." :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet7"::: When performing binary operations or numeric conversions, it is always the responsibility of the developer to verify that a method is using the appropriate numeric representation to interpret a particular value. As the following example illustrates, you can ensure that the method handles overflows appropriately by first determining whether a value represents an unsigned or a signed type when converting it to its hexadecimal string representation. Throw an exception if the original value was an unsigned type but the conversion back to an integer yields a value whose sign bit is on. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet8"::: The following example attempts to interpret each element in a string array as a hexadecimal string and convert it to a long integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt64/toint64_2.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt64/toint64_2.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt64/toint64_2.vb" id="Snippet15"::: ]]> is not 2, 8, 10, or 16. -or- , which represents a non-base 10 signed number, is prefixed with a negative sign. is . contains a character that is not a valid digit in the base specified by . The exception message indicates that there are no digits to convert if the first character in is invalid; otherwise, the message indicates that contains invalid trailing characters. , which represents a non-base 10 signed number, is prefixed with a negative sign. -or- represents a number that is less than Int64.MinValue or greater than Int64.MaxValue. System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to an 8-bit signed integer. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The Boolean value to convert. Converts the specified Boolean value to the equivalent 8-bit signed integer. The number 1 if is ; otherwise, 0. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to the equivalent 8-bit signed integer. An 8-bit signed integer that is equivalent to . is greater than SByte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The Unicode character to convert. Converts the value of the specified Unicode character to the equivalent 8-bit signed integer. An 8-bit signed integer that is equivalent to . values to a signed byte. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSByte/tosbyte1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSByte/tosbyte1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSByte/tosbyte1.vb" id="Snippet3"::: ]]> is greater than SByte.MaxValue. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The decimal number to convert. Converts the value of the specified decimal number to an equivalent 8-bit signed integer. , rounded to the nearest 8-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to a signed byte. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSByte/tosbyte1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSByte/tosbyte1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSByte/tosbyte1.vb" id="Snippet4"::: ]]> is greater than SByte.MaxValue or less than SByte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to an equivalent 8-bit signed integer. , rounded to the nearest 8-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to a signed byte. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSByte/tosbyte1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSByte/tosbyte1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSByte/tosbyte1.vb" id="Snippet5"::: ]]> is greater than SByte.MaxValue or less than SByte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to the equivalent 8-bit signed integer. An 8-bit signed integer that is equivalent to . is greater than SByte.MaxValue or less than SByte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to an equivalent 8-bit signed integer. An 8-bit signed integer that is equivalent to . is greater than SByte.MaxValue or less than SByte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to an equivalent 8-bit signed integer. An 8-bit signed integer that is equivalent to . is greater than SByte.MaxValue or less than SByte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte An object that implements the interface, or . Converts the value of the specified object to an 8-bit signed integer. An 8-bit signed integer that is equivalent to , or zero if is . method of the underlying type of `value`. ## Examples The following example attempts to convert each element in an object array to a signed byte. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSByte/tosbyte1.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSByte/tosbyte1.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSByte/tosbyte1.vb" id="Snippet9"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than SByte.MinValue or greater than SByte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The 8-bit signed integer to return. Returns the specified 8-bit signed integer; no actual conversion is performed. is returned unchanged. To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The single-precision floating-point number to convert. Converts the value of the specified single-precision floating-point number to an equivalent 8-bit signed integer. , rounded to the nearest 8-bit signed integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to a signed byte. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSByte/tosbyte1.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSByte/tosbyte1.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSByte/tosbyte1.vb" id="Snippet9"::: ]]> is greater than SByte.MaxValue or less than SByte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte A string that contains the number to convert. Converts the specified string representation of a number to an equivalent 8-bit signed integer. An 8-bit signed integer that is equivalent to the number in , or 0 (zero) if value is . method is equivalent to passing `value` to the method. `value` is interpreted by using the formatting conventions of the current culture. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example converts string representations of values with the `ToSByte` method, using default formatting. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/tosbyte.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/tosbyte.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/tosbyte.vb" id="Snippet4"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than SByte.MinValue or greater than SByte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to the equivalent 8-bit signed integer. An 8-bit signed integer that is equivalent to . is greater than SByte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to an equivalent 8-bit signed integer. An 8-bit signed integer that is equivalent to . is greater than SByte.MaxValue or less than SByte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to an equivalent 8-bit signed integer. An 8-bit signed integer that is equivalent to . is greater than SByte.MaxValue or less than SByte.MinValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to an 8-bit signed integer, using the specified culture-specific formatting information. An 8-bit signed integer that is equivalent to , or zero if is . that represents a number, `provider` could supply culture-specific information about the notation used to represent that number. The base types ignore `provider`; however, the parameter may be used if `value` is a user-defined type that implements the interface. ## Examples The following example defines a `ByteString` class that stores both signed and unsigned bytes as hexadecimal strings along with a field that indicates the sign of the byte. The `ByteString` class implements the interface. Its method calls the method to perform the conversion. If it fails, it throws an . :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSByte/tosbyte2.cs" id="Snippet14"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSByte/tosbyte2.fs" id="Snippet14"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSByte/tosbyte2.vb" id="Snippet14"::: The following example shows how the implementation of the `ByteString` class is called by the method. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSByte/tosbyte2.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSByte/tosbyte2.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSByte/tosbyte2.vb" id="Snippet15"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than SByte.MinValue or greater than SByte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] A string that contains the number to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent 8-bit signed integer, using the specified culture-specific formatting information. An 8-bit signed integer that is equivalent to . instance that obtains a object. The object provides culture-specific information about the format of `value`. If `provider` is `null`, the for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example converts string representations of values with the `ToSByte` method, using an object. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToInt16/tosbyte.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToInt16/tosbyte.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToInt16/tosbyte.vb" id="Snippet4"::: ]]> is . does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than SByte.MinValue or greater than SByte.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.SByte A string that contains the number to convert. The base of the number in , which must be 2, 8, 10, or 16. Converts the string representation of a number in a specified base to an equivalent 8-bit signed integer. An 8-bit signed integer that is equivalent to the number in , or 0 (zero) if is . method assumes that negative numbers use two's complement representation. In other words, the method always interprets the high-order bit of a byte (bit 7) as its sign bit. As a result, it is possible to write code in which a non-base 10 number that is out of the range of the data type is converted to an value without the method throwing an exception. The following example converts to its hexadecimal string representation, and then calls the method. Instead of throwing an exception, the method displays the message, "0xff converts to -1." :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet9"::: When performing binary operations or numeric conversions, it is always the responsibility of the developer to verify that a method is using the appropriate numeric representation to interpret a particular value. As the following example illustrates, you can ensure that the method handles overflows appropriately by first determining whether a value represents an unsigned or a signed type when converting it to its hexadecimal string representation. Throw an exception if the original value was an unsigned type but the conversion back to a signed byte yields a value whose sign bit is on. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet10"::: ## Examples The following example attempts to interpret the elements in a string array as the binary, octal, and hexadecimal representation of numeric values in order to convert them to unsigned bytes. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSByte/tosbyte3.cs" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSByte/tosbyte3.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSByte/tosbyte3.vb" id="Snippet16"::: ]]> is not 2, 8, 10, or 16. -or- , which represents a non-base 10 signed number, is prefixed with a negative sign. is . contains a character that is not a valid digit in the base specified by . The exception message indicates that there are no digits to convert if the first character in is invalid; otherwise, the message indicates that contains invalid trailing characters. , which represents a non-base 10 signed number, is prefixed with a negative sign. -or- represents a number that is less than SByte.MinValue or greater than SByte.MaxValue. System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to a single-precision floating-point number. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single The Boolean value to convert. Converts the specified Boolean value to the equivalent single-precision floating-point number. The number 1 if is ; otherwise, 0. values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to the equivalent single-precision floating-point number. A single-precision floating-point number that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet2"::: ]]> Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single The Unicode character to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single The decimal number to convert. Converts the value of the specified decimal number to an equivalent single-precision floating-point number. A single-precision floating-point number that is equivalent to . is rounded using rounding to nearest. For example, when rounded to two decimals, the value 2.345 becomes 2.34 and the value 2.355 becomes 2.36. values to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet3"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to an equivalent single-precision floating-point number. A single-precision floating-point number that is equivalent to . is rounded using rounding to nearest. For example, when rounded to two decimals, the value 2.345 becomes 2.34 and the value 2.355 becomes 2.36. values to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet4"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to an equivalent single-precision floating-point number. A single-precision floating-point number that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet5"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to an equivalent single-precision floating-point number. A single-precision floating-point number that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet6"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to an equivalent single-precision floating-point number. A single-precision floating-point number that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet7"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single An object that implements the interface, or . Converts the value of the specified object to a single-precision floating-point number. A single-precision floating-point number that is equivalent to , or zero if is . method of the underlying type of `value`. ## Examples The following example attempts to convert each element in an object array to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet8"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than Single.MinValue or greater than Single.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Single The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to the equivalent single-precision floating-point number. An 8-bit signed integer that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet9"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single The single-precision floating-point number to return. Returns the specified single-precision floating-point number; no actual conversion is performed. is returned unchanged. To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single A string that contains the number to convert. Converts the specified string representation of a number to an equivalent single-precision floating-point number. A single-precision floating-point number that is equivalent to the number in , or 0 (zero) if is . method is equivalent to passing `value` to the method. `value` is interpreted by using the formatting conventions of the current culture. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example attempts to convert each element in an array of numeric strings to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet10"::: ]]> is not a number in a valid format. represents a number that is less than Single.MinValue or greater than Single.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Single The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to the equivalent single-precision floating-point number. A single-precision floating-point number that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet11"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Single The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to an equivalent single-precision floating-point number. A single-precision floating-point number that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet12"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.Single The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to an equivalent single-precision floating-point number. A single-precision floating-point number that is equivalent to . value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle1.cs" id="Snippet13"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle1.fs" id="Snippet13"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle1.vb" id="Snippet13"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to an single-precision floating-point number, using the specified culture-specific formatting information. A single-precision floating-point number that is equivalent to , or zero if is . method of the underlying type of `value`. `provider` enables the user to specify culture-specific conversion information about the contents of `value`. For example, if `value` is a that represents a number, `provider` could supply culture-specific information about the notation used to represent that number. The base types ignore `provider`; however, the parameter may be used if `value` is a user-defined type that implements the interface. ## Examples The following example defines a `Temperature` class that implements the interface. Its implementation of the method returns the internal value of a private variable that represents the temperature. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle2.cs" id="Snippet14"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle2.fs" id="Snippet14"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle2.vb" id="Snippet14"::: The following example illustrates how a call to the method, in turn, calls the implementation of the `Temperature` class. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle2.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle2.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle2.vb" id="Snippet15"::: ]]> is not in an appropriate format. does not implement . represents a number that is less than Single.MinValue or greater than Single.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Single A string that contains the number to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent single-precision floating-point number, using the specified culture-specific formatting information. A single-precision floating-point number that is equivalent to the number in , or 0 (zero) if is . method on `value`. `provider` is an instance that obtains a object. The object provides culture-specific information about the format of `value`. If `provider` is `null`, the for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example uses objects that represent the en-US and fr-FR cultures when it converts the elements in an array of numeric strings to values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToSingle/tosingle3.cs" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToSingle/tosingle3.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToSingle/tosingle3.vb" id="Snippet16"::: ]]> is not a number in a valid format. represents a number that is less than Single.MinValue or greater than Single.MaxValue. System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts the specified value to its equivalent string representation. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String The Boolean value to convert. Converts the specified Boolean value to its equivalent string representation. The string representation of . . It returns for `true` values and for `false` values. ## Examples The following example illustrates the conversion of a to a , using `ToString`. It also illustrates that the string returned by the conversion equals either or . :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/ToString_Bool1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/ToString_Bool1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/ToString_Bool1.vb" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Convert.ToString/fs/ToString_Bool1.fs" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to its equivalent string representation. The string representation of . . ## Examples The following example converts each value in a array to a string. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/ToString.Byte1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/ToString.Byte1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/ToString.Byte1.vb" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.Convert.ToString/fs/ToString_Byte1.fs" id="Snippet3"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String The Unicode character to convert. Converts the value of the specified Unicode character to its equivalent string representation. The string representation of . . ## Examples The following example converts a to a . :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet14"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet14"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet14"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String The date and time value to convert. Converts the value of the specified to its equivalent string representation. The string representation of . . It uses the formatting conventions of the current culture and the "G" format specifier to convert a value to its string representation. ## Examples The following example converts each element in an array of a value to a value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring1.cs" id="Snippet1"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring1.fs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring1.vb" id="Snippet1"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String The decimal number to convert. Converts the value of the specified decimal number to its equivalent string representation. The string representation of . . ## Examples The following example converts a to a . :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet15"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to its equivalent string representation. The string representation of . . ## Examples The following example converts a to a . :::code language="csharp" source="~/snippets/csharp/System/Convert/ToBoolean/system.convert snippet.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToBoolean/system.convert snippet.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToBoolean/system.convert snippet.vb" id="Snippet7"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to its equivalent string representation. The string representation of . . ## Examples The following example converts each element in an array of 16-bit integers to its equivalent string representation. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring1.vb" id="Snippet2"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to its equivalent string representation. The string representation of . . It formats `value` by using the formatting conventions of the current culture. ## Examples The following example compares the method with the method. It defines a custom object that uses the sting "minus" to represent the negative sign. It converts each element in an integer array to its equivalent string representation using default formatting (the formatting conventions of the current culture) and the custom format provider. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring7.cs" id="Snippet27"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring7.fs" id="Snippet27"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring7.vb" id="Snippet27"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to its equivalent string representation. The string representation of . . ## Examples The following example converts each element in a long integer array to its equivalent string representation. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring6.cs" id="Snippet28"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring6.fs" id="Snippet28"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring6.vb" id="Snippet28"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String An object that supplies the value to convert, or . Converts the value of the specified object to its equivalent string representation. The string representation of , or if is . implementation of `value`. If `value` does not implement the interface, the method tries to call the implementation of `value`. If value does not implement the interface, the method calls the `ToString` method of the underlying type of `value`. ## Examples The following example converts each element in an object array to its equivalent string representation. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring1.cs" id="Snippet3"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring1.fs" id="Snippet3"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring1.vb" id="Snippet3"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.String The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to its equivalent string representation. The string representation of . . ## Examples The following example converts each element in a signed byte array to its equivalent string representation. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring1.vb" id="Snippet4"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String The single-precision floating-point number to convert. Converts the value of the specified single-precision floating-point number to its equivalent string representation. The string representation of . . ## Examples The following example converts each element in an array of values to its equivalent string representation. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring1.vb" id="Snippet5"::: ]]> Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Diagnostics.CodeAnalysis.NotNullIfNotNull("value")] [<System.Diagnostics.CodeAnalysis.NotNullIfNotNull("value")>] The string to return. Returns the specified string instance; no actual conversion is performed. is returned unchanged. method and calls the method to confirm that the method returns the original string. The example also calls the method to ensure that the two strings are not identical because the original string is interned. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring_string1.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring_string1.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring_string1.vb" id="Snippet2"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.String The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to its equivalent string representation. The string representation of . . ## Examples The following example converts each element in an array of unsigned 16-bit integer values to its equivalent string representation. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring1.cs" id="Snippet6"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring1.fs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring1.vb" id="Snippet6"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.String The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to its equivalent string representation. The string representation of . . ## Examples The following example converts each element in an unsigned integer array to its equivalent string representation. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring1.cs" id="Snippet7"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring1.fs" id="Snippet7"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring1.vb" id="Snippet7"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.String The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to its equivalent string representation. The string representation of . . ## Examples The following example converts each element in an unsigned long integer array to its equivalent string representation. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring1.cs" id="Snippet8"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring1.fs" id="Snippet8"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring1.vb" id="Snippet8"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The Boolean value to convert. An instance of an object. This parameter is ignored. Converts the specified Boolean value to its equivalent string representation. The string representation of . . It returns for `true` values and for `false` values. ## Examples The following example converts a value to a with the `ToString` method, using an object that displays the type of the format provider for which it is called. The example shows that the object is not referenced. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/nonnumeric.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/nonnumeric.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/nonnumeric.vb" id="Snippet2"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The 8-bit unsigned integer to convert. An object that supplies culture-specific formatting information. Converts the value of the specified 8-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . ## Examples The following example converts each element in an unsigned byte array to its equivalent string representation using the formatting conventions of the en-US and fr-FR cultures. Because the "G" specifier by default outputs only decimal digits in a byte value's string representation, the `provider` parameter does not affect the formatting of the returned string. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet16"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Security.SecuritySafeCritical] [<System.Security.SecuritySafeCritical>] System.String The 8-bit unsigned integer to convert. The base of the return value, which must be 2, 8, 10, or 16. Converts the value of an 8-bit unsigned integer to its equivalent string representation in a specified base. The string representation of in base . method represents `value` by its magnitude only. If the method is called to create a string that will later be converted back to a number, a corresponding method that assumes a magnitude-only numeric representation should be called to perform the conversion. Such methods include or . ## Examples The following example converts each element in a byte array to its equivalent binary, hexadecimal, decimal, and hexadecimal string representations. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring2.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring2.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring2.vb" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.convert.tostring2/fs/tostring2.fs" id="Snippet9"::: ]]> is not 2, 8, 10, or 16. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The Unicode character to convert. An object that supplies culture-specific formatting information. This parameter is ignored. Converts the value of the specified Unicode character to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . The `provider` parameter is ignored. ## Examples The following example converts a value to a with the `ToString` method, using an object that displays the type of the format provider for which it is called. The example shows that the object is not referenced. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/nonnumeric.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/nonnumeric.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/nonnumeric.vb" id="Snippet2"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The date and time value to convert. An object that supplies culture-specific formatting information. Converts the value of the specified to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . ## Examples The following example converts a value to its equivalent string representation in eight different cultures. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet13"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet13"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet13"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The decimal number to convert. An object that supplies culture-specific formatting information. Converts the value of the specified decimal number to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . ## Examples The following example converts each element in an array of values to its equivalent string representation in four different cultures. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet14"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet14"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet14"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The double-precision floating-point number to convert. An object that supplies culture-specific formatting information. Converts the value of the specified double-precision floating-point number to its equivalent string representation. The string representation of . ## Examples The following example converts each element in an array of values to its equivalent string representation in four different cultures. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet15"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The 16-bit signed integer to convert. An object that supplies culture-specific formatting information. Converts the value of the specified 16-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . ## Examples The following example defines a custom class that defines its negative sign as the string "~" and its positive sign as the string "!". It then calls the method to convert each element in an array of 16-bit integers to its equivalent string representation. The conversion uses the invariant culture as well as the custom object. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet19"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet19"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet19"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Security.SecuritySafeCritical] [<System.Security.SecuritySafeCritical>] System.String The 16-bit signed integer to convert. The base of the return value, which must be 2, 8, 10, or 16. Converts the value of a 16-bit signed integer to its equivalent string representation in a specified base. The string representation of in base . method is called to create a string that will later be converted back to a number, a corresponding method that assumes a similar numeric representation should be called to perform the conversion. Such methods include and . ## Examples The following example converts each element in an array of 16-bit signed integers to its equivalent binary, octal, decimal, and hexadecimal string representations. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring2.cs" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring2.fs" id="Snippet10"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring2.vb" id="Snippet10"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.convert.tostring2/fs/tostring2.fs" id="Snippet10"::: ]]> is not 2, 8, 10, or 16. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The 32-bit signed integer to convert. An object that supplies culture-specific formatting information. Converts the value of the specified 32-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . ## Examples The following example defines a custom class that defines its negative sign as the string "~" and its positive sign as the string "!". It then calls the method to convert each element in an array of integers to its equivalent string representation. The conversion uses the invariant culture as well as the custom object. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet20"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet20"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet20"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Security.SecuritySafeCritical] [<System.Security.SecuritySafeCritical>] System.String The 32-bit signed integer to convert. The base of the return value, which must be 2, 8, 10, or 16. Converts the value of a 32-bit signed integer to its equivalent string representation in a specified base. The string representation of in base . method is called to create a string that will later be converted back to a number, a corresponding method that assumes a similar numeric representation should be called to perform the conversion. Such methods include and . ## Examples The following example converts each element in an integer array to its string representation in binary, octal, decimal, and hexadecimal. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring2.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring2.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring2.vb" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.convert.tostring2/fs/tostring2.fs" id="Snippet11"::: ]]> is not 2, 8, 10, or 16. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The 64-bit signed integer to convert. An object that supplies culture-specific formatting information. Converts the value of the specified 64-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . ## Examples The following example defines a custom class that defines its negative sign as the string "~" and its positive sign as the string "!". It then calls the method to convert each element in a long integer array to its equivalent string representation. The conversion uses the invariant culture as well as the custom object. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet21"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet21"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet21"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.Security.SecuritySafeCritical] [<System.Security.SecuritySafeCritical>] System.String The 64-bit signed integer to convert. The base of the return value, which must be 2, 8, 10, or 16. Converts the value of a 64-bit signed integer to its equivalent string representation in a specified base. The string representation of in base . method is called to create a string that will later be converted back to a number, a corresponding method that assumes a similar numeric representation should be called to perform the conversion. Such methods include and . ## Examples The following example converts each element in a long integer array to its equivalent binary, hexadecimal, decimal, and hexadecimal string representations. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring2.cs" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring2.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring2.vb" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/VS_Snippets_CLR_System/system.convert.tostring2/fs/tostring2.fs" id="Snippet12"::: ]]> is not 2, 8, 10, or 16. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String An object that supplies the value to convert, or . An object that supplies culture-specific formatting information. Converts the value of the specified object to its equivalent string representation using the specified culture-specific formatting information. The string representation of , or if is an object whose value is . If is , the method returns . interface, the method calls the implementation of `value`. Otherwise, if the `value` parameter implements the interface, the method calls its implementation. If `value` implements neither interface, the method calls the `value` parameter's `ToString()` method, and the `provider` parameter is ignored. The `provider` parameter is used if the `value` parameter implements the or interface. The most common use of the `provider` parameter is to specify culture-specific information used in the conversion of `value`. For example, if the `value` parameter is a negative decimal number, the `provider` parameter can supply culture-specific information about the notation used for the negative sign and decimal separator. The second example in the next section illustrates a format provider that does not supply culture-sensitive formatting information. ## Examples The following example defines a `Temperature` class that overrides the method but does not implement the interface. The example illustrates how calls to the method, in turn, call the `Temperature.ToString` method. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring5.cs" id="Snippet26"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring5.fs" id="Snippet26"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring5.vb" id="Snippet26"::: The following example defines a `Temperature` class that implements the interface but does not implement the interface. Its implementation represents the `Temperature` value in Celsius, Fahrenheit, or Kelvin, depending on the format string. The example also defines a `TemperatureProvider` class that implements and provides a randomly generated format string that is used by the implementation of the `Temperature` class. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring_obj30.cs" id="Snippet30"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring_obj30.fs" id="Snippet30"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring_obj30.vb" id="Snippet30"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The 8-bit signed integer to convert. An object that supplies culture-specific formatting information. Converts the value of the specified 8-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . ## Examples The following example defines a custom class that defines its negative sign as the string "~" and its positive sign as the string "!". It then calls the method to convert each element in signed byte array to its equivalent string representation. The conversion uses the invariant culture as well as the custom object. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet17"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The single-precision floating-point number to convert. An object that supplies culture-specific formatting information. Converts the value of the specified single-precision floating-point number to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . ## Examples The following example converts each element in an array of values to its equivalent string representation in four different cultures. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet18"::: ]]> Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.String [System.Diagnostics.CodeAnalysis.NotNullIfNotNull("value")] [<System.Diagnostics.CodeAnalysis.NotNullIfNotNull("value")>] The string to return. An object that supplies culture-specific formatting information. This parameter is ignored. Returns the specified string instance; no actual conversion is performed. is returned unchanged. parameter. The method returns the unmodified without referencing the object. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/nonnumeric.cs" id="Snippet2"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/nonnumeric.fs" id="Snippet2"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/nonnumeric.vb" id="Snippet2"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The 16-bit unsigned integer to convert. An object that supplies culture-specific formatting information. Converts the value of the specified 16-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . ## Examples The following example defines a custom class that defines its negative sign as the string "~" and its positive sign as the string "!". It then calls the method to convert a 16-bit unsigned integer value to its equivalent string representation. The conversion uses both the invariant culture and the custom object. The output indicates that this formatting information is not used, because by default the "G" format specifier does not include a positive sign with positive values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet22"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet22"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet22"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The 32-bit unsigned integer to convert. An object that supplies culture-specific formatting information. Converts the value of the specified 32-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . ## Examples The following example defines a custom class that defines its negative sign as the string "~" and its positive sign as the string "!". It then calls the method to convert an unsigned integer value to its equivalent string representation. The conversion uses both the invariant culture and the custom object. The output indicates that this formatting information is not used, because by default the "G" format specifier does not include a positive sign with positive values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet23"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet23"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet23"::: ]]> Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.String [System.Runtime.CompilerServices.Nullable(2)] [<System.Runtime.CompilerServices.Nullable(2)>] The 64-bit unsigned integer to convert. An object that supplies culture-specific formatting information. Converts the value of the specified 64-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information. The string representation of . . ## Examples The following example defines a custom class that defines its negative sign as the string "~" and its positive sign as the string "!". It then calls the method to convert an unsigned long integer value to its equivalent string representation. The conversion uses both the invariant culture and the custom object. The output indicates that this formatting information is not used, because by default the "G" format specifier does not include a positive sign with positive values. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToString/tostring3.cs" id="Snippet24"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToString/tostring3.fs" id="Snippet24"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToString/tostring3.vb" id="Snippet24"::: ]]> System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to a 16-bit unsigned integer. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The Boolean value to convert. Converts the specified Boolean value to the equivalent 16-bit unsigned integer. The number 1 if is ; otherwise, 0. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to the equivalent 16-bit unsigned integer. A 16-bit unsigned integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The Unicode character to convert. Converts the value of the specified Unicode character to the equivalent 16-bit unsigned integer. The 16-bit unsigned integer equivalent to . Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The decimal number to convert. Converts the value of the specified decimal number to an equivalent 16-bit unsigned integer. , rounded to the nearest 16-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an unsigned 16-bit integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt16/touint16_1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt16/touint16_1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt16/touint16_1.vb" id="Snippet4"::: ]]> is less than zero or greater than UInt16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to an equivalent 16-bit unsigned integer. , rounded to the nearest 16-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an unsigned 16-bit integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt16/touint16_1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt16/touint16_1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt16/touint16_1.vb" id="Snippet5"::: ]]> is less than zero or greater than UInt16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to the equivalent 16-bit unsigned integer. A 16-bit unsigned integer that is equivalent to . is less than zero. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to an equivalent 16-bit unsigned integer. A 16-bit unsigned integer that is equivalent to . is less than zero or greater than UInt16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to an equivalent 16-bit unsigned integer. A 16-bit unsigned integer that is equivalent to . is less than zero or greater than UInt16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 An object that implements the interface, or . Converts the value of the specified object to a 16-bit unsigned integer. A 16-bit unsigned integer that is equivalent to , or zero if is . method of the underlying type of `value`. ## Examples The following example attempts to convert each element in an object array to an unsigned 16-bit integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt16/touint16_1.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt16/touint16_1.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt16/touint16_1.vb" id="Snippet9"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than UInt16.MinValue or greater than UInt16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to the equivalent 16-bit unsigned integer. A 16-bit unsigned integer that is equivalent to . is less than zero. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The single-precision floating-point number to convert. Converts the value of the specified single-precision floating-point number to an equivalent 16-bit unsigned integer. , rounded to the nearest 16-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an unsigned 16-bit integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt16/touint16_1.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt16/touint16_1.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt16/touint16_1.vb" id="Snippet11"::: ]]> is less than zero or greater than UInt16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 A string that contains the number to convert. Converts the specified string representation of a number to an equivalent 16-bit unsigned integer. A 16-bit unsigned integer that is equivalent to the number in , or 0 (zero) if is . method is equivalent to passing `value` to the method. `value` is interpreted by using the formatting conventions of the current culture. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example attempts to convert each element in a numeric string array to a 16-bit unsigned integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt16/touint16_1.cs" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt16/touint16_1.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt16/touint16_1.vb" id="Snippet12"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than UInt16.MinValue or greater than UInt16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The 16-bit unsigned integer to return. Returns the specified 16-bit unsigned integer; no actual conversion is performed. is returned unchanged. To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to an equivalent 16-bit unsigned integer. A 16-bit unsigned integer that is equivalent to . is greater than UInt16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to an equivalent 16-bit unsigned integer. A 16-bit unsigned integer that is equivalent to . is greater than UInt16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to a 16-bit unsigned integer, using the specified culture-specific formatting information. A 16-bit unsigned integer that is equivalent to , or zero if is . method of the underlying type of `value`. `provider` enables the user to specify culture-specific conversion information about the contents of `value`. For example, if `value` is a that represents a number, `provider` could supply culture-specific information about the notation used to represent that number. The base types ignore `provider`; however, the parameter may be used if `value` is a user-defined type that implements the interface. ## Examples The following example defines a `HexString` class that implements the interface and that is designed to hold the string representation of both 16-bit signed and 16-bit unsigned values. The class includes a `Sign` property that indicates the sign of its hexadecimal value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt16/touint16_3.cs" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt16/touint16_3.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt16/touint16_3.vb" id="Snippet16"::: The following example shows that a call to the method that passes a `HexString` object as a parameter, in turn, calls the implementation of the `HexString` class. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt16/touint16_3.cs" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt16/touint16_3.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt16/touint16_3.vb" id="Snippet17"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than UInt16.MinValue or greater than UInt16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 A string that contains the number to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent 16-bit unsigned integer, using the specified culture-specific formatting information. A 16-bit unsigned integer that is equivalent to the number in , or 0 (zero) if is . on `value`. `provider` is an instance that obtains a object. The object provides culture-specific information about the format of `value`. If `provider` is `null`, the for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example defines a custom object that recognizes the string "pos" as the positive sign and the string "neg" as the negative sign. It then attempts to convert each element of a numeric string array to an integer using both this provider and the provider for the invariant culture. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt16/touint16_4.cs" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt16/touint16_4.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt16/touint16_4.vb" id="Snippet18"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than UInt16.MinValue or greater than UInt16.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt16 A string that contains the number to convert. The base of the number in , which must be 2, 8, 10, or 16. Converts the string representation of a number in a specified base to an equivalent 16-bit unsigned integer. A 16-bit unsigned integer that is equivalent to the number in , or 0 (zero) if is . data type supports unsigned values only, the method assumes that `value` is expressed using unsigned binary representation. In other words, all 16 bits are used to represent the numeric value, and a sign bit is absent. As a result, it is possible to write code in which a signed integer value that is out of the range of the data type is converted to a value without the method throwing an exception. The following example converts to its hexadecimal string representation, and then calls the method. Instead of throwing an exception, the method displays the message, "0x8000 converts to 32768." :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet11"::: When performing binary operations or numeric conversions, it is always the responsibility of the developer to verify that a method or operator is using the appropriate numeric representation to interpret a particular value. The following example illustrates one technique for ensuring that the method does not inappropriately use binary representation to interpret a value that uses two's complement representation when converting a hexadecimal string to a value. The example determines whether a value represents a signed or an unsigned integer while it is converting that value to its string representation. When the example converts the value to a value, it checks whether the original value was a signed integer. If so, and if its high-order bit is set (which indicates that the original value was negative), the method throws an exception. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet12"::: ## Examples The following example attempts to interpret each element in an array of numeric strings as a hexadecimal value and to convert it to an unsigned 16-bit integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt16/touint16_2.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt16/touint16_2.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt16/touint16_2.vb" id="Snippet15"::: ]]> is not 2, 8, 10, or 16. -or- , which represents a non-base 10 unsigned number, is prefixed with a negative sign. is . contains a character that is not a valid digit in the base specified by . The exception message indicates that there are no digits to convert if the first character in is invalid; otherwise, the message indicates that contains invalid trailing characters. , which represents a non-base 10 unsigned number, is prefixed with a negative sign. -or- represents a number that is less than UInt16.MinValue or greater than UInt16.MaxValue. System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to a 32-bit unsigned integer. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The Boolean value to convert. Converts the specified Boolean value to the equivalent 32-bit unsigned integer. The number 1 if is ; otherwise, 0. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to the equivalent 32-bit unsigned integer. A 32-bit unsigned integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The Unicode character to convert. Converts the value of the specified Unicode character to the equivalent 32-bit unsigned integer. A 32-bit unsigned integer that is equivalent to . Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The decimal number to convert. Converts the value of the specified decimal number to an equivalent 32-bit unsigned integer. , rounded to the nearest 32-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an unsigned integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt32/touint32_1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt32/touint32_1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt32/touint32_1.vb" id="Snippet4"::: ]]> is less than zero or greater than UInt32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to an equivalent 32-bit unsigned integer. , rounded to the nearest 32-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an unsigned integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt32/touint32_1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt32/touint32_1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt32/touint32_1.vb" id="Snippet5"::: ]]> is less than zero or greater than UInt32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to the equivalent 32-bit unsigned integer. A 32-bit unsigned integer that is equivalent to . is less than zero. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to an equivalent 32-bit unsigned integer. A 32-bit unsigned integer that is equivalent to . is less than zero. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to an equivalent 32-bit unsigned integer. A 32-bit unsigned integer that is equivalent to . is less than zero or greater than UInt32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 An object that implements the interface, or . Converts the value of the specified object to a 32-bit unsigned integer. A 32-bit unsigned integer that is equivalent to , or 0 (zero) if is . method of the underlying type of `value`. ## Examples The following example attempts to convert each element in an object array to an unsigned integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt32/touint32_1.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt32/touint32_1.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt32/touint32_1.vb" id="Snippet9"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than UInt32.MinValue or greater than UInt32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to the equivalent 32-bit unsigned integer. A 32-bit unsigned integer that is equivalent to . is less than zero. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The single-precision floating-point number to convert. Converts the value of the specified single-precision floating-point number to an equivalent 32-bit unsigned integer. , rounded to the nearest 32-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an unsigned integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt32/touint32_1.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt32/touint32_1.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt32/touint32_1.vb" id="Snippet11"::: ]]> is less than zero or greater than UInt32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 A string that contains the number to convert. Converts the specified string representation of a number to an equivalent 32-bit unsigned integer. A 32-bit unsigned integer that is equivalent to the number in , or 0 (zero) if is . method is equivalent to passing `value` to the method. `value` is interpreted by using the formatting conventions of the current culture. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example interprets the elements in a string array as numeric strings and attempts to convert them to unsigned integers. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt32/touint32_1.cs" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt32/touint32_1.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt32/touint32_1.vb" id="Snippet12"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than UInt32.MinValue or greater than UInt32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to the equivalent 32-bit unsigned integer. A 32-bit unsigned integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The 32-bit unsigned integer to return. Returns the specified 32-bit unsigned integer; no actual conversion is performed. is returned unchanged. To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 The 64-bit unsigned integer to convert. Converts the value of the specified 64-bit unsigned integer to an equivalent 32-bit unsigned integer. A 32-bit unsigned integer that is equivalent to . is greater than UInt32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to a 32-bit unsigned integer, using the specified culture-specific formatting information. A 32-bit unsigned integer that is equivalent to , or zero if is . method of the underlying type of `value`. `provider` enables the user to specify culture-specific conversion information about the contents of `value`. For example, if `value` is a that represents a number, `provider` could supply culture-specific information about the notation used to represent that number. The base types ignore `provider`; however, the parameter may be used if `value` is a user-defined type that implements the interface. ## Examples The following example defines a `HexString` class that implements the interface and that is designed to hold the string representation of both 32-bit signed and 32-bit unsigned values. The class includes a `Sign` property that indicates the sign of its hexadecimal value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt32/touint32_4.cs" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt32/touint32_4.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt32/touint32_4.vb" id="Snippet17"::: The following example shows that a call to the method that passes a `HexString` object as a parameter, in turn, calls the implementation of the `HexString` class. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt32/touint32_4.cs" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt32/touint32_4.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt32/touint32_4.vb" id="Snippet18"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than UInt32.MinValue or greater than UInt32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 A string that contains the number to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent 32-bit unsigned integer, using the specified culture-specific formatting information. A 32-bit unsigned integer that is equivalent to the number in , or 0 (zero) if is . on `value`. `provider` is an instance that obtains a object. The object provides culture-specific information about the format of `value`. If `provider` is `null`, the for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example defines a custom object that recognizes the string "pos" as the positive sign and the string "neg" as the negative sign. It then attempts to convert each element of a numeric string array to an integer using both this provider and the provider for the invariant culture. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt32/touint32_2.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt32/touint32_2.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt32/touint32_2.vb" id="Snippet15"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than UInt32.MinValue or greater than UInt32.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt32 A string that contains the number to convert. The base of the number in , which must be 2, 8, 10, or 16. Converts the string representation of a number in a specified base to an equivalent 32-bit unsigned integer. A 32-bit unsigned integer that is equivalent to the number in , or 0 (zero) if is . data type supports unsigned values only, the method assumes that `value` is expressed using unsigned binary representation. In other words, all 32 bits are used to represent the numeric value, and a sign bit is absent. As a result, it is possible to write code in which a signed integer value that is out of the range of the data type is converted to a value without the method throwing an exception. The following example converts to its hexadecimal string representation, and then calls the method. Instead of throwing an exception, the method displays the message, "0x80000000 converts to 2147483648." :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet13"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet13"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet13"::: When performing binary operations or numeric conversions, it is always the responsibility of the developer to verify that a method or operator is using the appropriate numeric representation to interpret a particular value. The following example illustrates one technique for ensuring that the method does not inappropriately use binary representation to interpret a value that uses two's complement representation when converting a hexadecimal string to a value. The example determines whether a value represents a signed or an unsigned integer while it is converting that value to its string representation. When the example converts the value to a value, it checks whether the original value was a signed integer. If so, and if its high-order bit is set (which indicates that the original value was negative), the method throws an exception. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet14"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet14"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet14"::: ## Examples The following example attempts to interpret each element in an array of numeric strings as a hexadecimal value and to convert it to an unsigned integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt32/touint32_3.cs" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt32/touint32_3.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt32/touint32_3.vb" id="Snippet16"::: ]]> is not 2, 8, 10, or 16. -or- , which represents a non-base 10 unsigned number, is prefixed with a negative sign. is . contains a character that is not a valid digit in the base specified by . The exception message indicates that there are no digits to convert if the first character in is invalid; otherwise, the message indicates that contains invalid trailing characters. , which represents a non-base 10 unsigned number, is prefixed with a negative sign. -or- represents a number that is less than UInt32.MinValue or greater than UInt32.MaxValue. System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 Converts a specified value to a 64-bit unsigned integer. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The Boolean value to convert. Converts the specified Boolean value to the equivalent 64-bit unsigned integer. The number 1 if is ; otherwise, 0. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The 8-bit unsigned integer to convert. Converts the value of the specified 8-bit unsigned integer to the equivalent 64-bit unsigned integer. A 64-bit signed integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The Unicode character to convert. Converts the value of the specified Unicode character to the equivalent 64-bit unsigned integer. A 64-bit unsigned integer that is equivalent to . Method mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime.Extensions 4.2.0.0 4.2.1.0 4.2.2.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The date and time value to convert. Calling this method always throws . This conversion is not supported. No value is returned. To be added. This conversion is not supported. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The decimal number to convert. Converts the value of the specified decimal number to an equivalent 64-bit unsigned integer. , rounded to the nearest 64-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an unsigned long integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt64/touint64_1.cs" id="Snippet4"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt64/touint64_1.fs" id="Snippet4"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt64/touint64_1.vb" id="Snippet4"::: ]]> is less than zero or greater than UInt64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] [System.Security.SecuritySafeCritical] [<System.Security.SecuritySafeCritical>] System.UInt64 The double-precision floating-point number to convert. Converts the value of the specified double-precision floating-point number to an equivalent 64-bit unsigned integer. , rounded to the nearest 64-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an unsigned long integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt64/touint64_1.cs" id="Snippet5"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt64/touint64_1.fs" id="Snippet5"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt64/touint64_1.vb" id="Snippet5"::: ]]> is less than zero or greater than UInt64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The 16-bit signed integer to convert. Converts the value of the specified 16-bit signed integer to the equivalent 64-bit unsigned integer. A 64-bit unsigned integer that is equivalent to . is less than zero. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The 32-bit signed integer to convert. Converts the value of the specified 32-bit signed integer to an equivalent 64-bit unsigned integer. A 64-bit unsigned integer that is equivalent to . is less than zero. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The 64-bit signed integer to convert. Converts the value of the specified 64-bit signed integer to an equivalent 64-bit unsigned integer. A 64-bit unsigned integer that is equivalent to . is less than zero. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 An object that implements the interface, or . Converts the value of the specified object to a 64-bit unsigned integer. A 64-bit unsigned integer that is equivalent to , or zero if is . method of the underlying type of `value`. ## Examples The following example attempts to convert each element in an object array to an unsigned long integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt64/touint64_1.cs" id="Snippet9"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt64/touint64_1.fs" id="Snippet9"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt64/touint64_1.vb" id="Snippet9"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than UInt64.MinValue or greater than UInt64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The 8-bit signed integer to convert. Converts the value of the specified 8-bit signed integer to the equivalent 64-bit unsigned integer. A 64-bit unsigned integer that is equivalent to . is less than zero. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The single-precision floating-point number to convert. Converts the value of the specified single-precision floating-point number to an equivalent 64-bit unsigned integer. , rounded to the nearest 64-bit unsigned integer. If is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6. values to an unsigned long integer. The output shows that fractional values are rounded before the conversion is performed. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt64/touint64_1.cs" id="Snippet11"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt64/touint64_1.fs" id="Snippet11"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt64/touint64_1.vb" id="Snippet11"::: ]]> is less than zero or greater than UInt64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 A string that contains the number to convert. Converts the specified string representation of a number to an equivalent 64-bit unsigned integer. A 64-bit signed integer that is equivalent to the number in , or 0 (zero) if is . method is equivalent to passing `value` to the method. `value` is interpreted by using the formatting conventions of the current culture. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example interprets the elements of a string array as numeric strings and attempts to convert them to unsigned long integers. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt64/touint64_1.cs" id="Snippet12"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt64/touint64_1.fs" id="Snippet12"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt64/touint64_1.vb" id="Snippet12"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than UInt64.MinValue or greater than UInt64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The 16-bit unsigned integer to convert. Converts the value of the specified 16-bit unsigned integer to the equivalent 64-bit unsigned integer. A 64-bit unsigned integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The 32-bit unsigned integer to convert. Converts the value of the specified 32-bit unsigned integer to an equivalent 64-bit unsigned integer. A 64-bit unsigned integer that is equivalent to . Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 The 64-bit unsigned integer to return. Returns the specified 64-bit unsigned integer; no actual conversion is performed. is returned unchanged. To be added. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 An object that implements the interface. An object that supplies culture-specific formatting information. Converts the value of the specified object to a 64-bit unsigned integer, using the specified culture-specific formatting information. A 64-bit unsigned integer that is equivalent to , or zero if is . method of the underlying type of `value`. `provider` enables the user to specify culture-specific conversion information about the contents of `value`. For example, if `value` is a that represents a number, `provider` could supply culture-specific information about the notation used to represent that number. The base types ignore `provider`; however, the parameter may be used if `value` is a user-defined type that implements the interface. ## Examples The following example defines a `HexString` class that implements the interface and that is designed to hold the string representation of both 64-bit signed and 64-bit unsigned values. The class includes a `Sign` property that indicates the sign of its hexadecimal value. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt64/touint64_4.cs" id="Snippet17"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt64/touint64_4.fs" id="Snippet17"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt64/touint64_4.vb" id="Snippet17"::: The following example shows that a call to the method that passes a `HexString` object as a parameter, in turn, calls the implementation of the `HexString` class. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt64/touint64_4.cs" id="Snippet18"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt64/touint64_4.fs" id="Snippet18"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt64/touint64_4.vb" id="Snippet18"::: ]]> is not in an appropriate format. does not implement the interface. -or- The conversion is not supported. represents a number that is less than UInt64.MinValue or greater than UInt64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 A string that contains the number to convert. An object that supplies culture-specific formatting information. Converts the specified string representation of a number to an equivalent 64-bit unsigned integer, using the specified culture-specific formatting information. A 64-bit unsigned integer that is equivalent to the number in , or 0 (zero) if is . on `value`. `provider` is an implementation that obtains a object. The object provides culture-specific information about the format of `value`. If `provider` is `null`, the object for the current culture is used. If you prefer not to handle an exception if the conversion fails, you can call the method instead. It returns a value that indicates whether the conversion succeeded or failed. ## Examples The following example defines a custom object that recognizes the string "pos" as the positive sign and the string "neg" as the negative sign. It then attempts to convert each element of a numeric string array to an unsigned long integer. The conversion uses both the custom provider and the provider for the invariant culture. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt64/touint64_2.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt64/touint64_2.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt64/touint64_2.vb" id="Snippet15"::: ]]> does not consist of an optional sign followed by a sequence of digits (0 through 9). represents a number that is less than UInt64.MinValue or greater than UInt64.MaxValue. Method System.Runtime.Extensions 4.0.0.0 4.0.10.0 4.1.0.0 4.2.0.0 4.2.1.0 4.2.2.0 mscorlib 1.0.5000.0 2.0.0.0 2.0.5.0 4.0.0.0 netstandard 2.0.0.0 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 [System.CLSCompliant(false)] [<System.CLSCompliant(false)>] System.UInt64 A string that contains the number to convert. The base of the number in , which must be 2, 8, 10, or 16. Converts the string representation of a number in a specified base to an equivalent 64-bit unsigned integer. A 64-bit unsigned integer that is equivalent to the number in , or 0 (zero) if is . data type supports unsigned values only, the method assumes that `value` is expressed using unsigned binary representation. In other words, all 64 bits are used to represent the numeric value, and a sign bit is absent. As a result, it is possible to write code in which a signed long integer value that is out of the range of the data type is converted to a value without the method throwing an exception. The following example converts to its hexadecimal string representation, and then calls the method. Instead of throwing an exception, the method displays the message, "0x8000000000000000 converts to 9223372036854775808." :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet15"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet15"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet15"::: When performing binary operations or numeric conversions, it is always the responsibility of the developer to verify that a method or operator is using the appropriate numeric representation to interpret a particular value. The following example illustrates one technique for ensuring that the method does not inappropriately use binary representation to interpret a value that uses two's complement representation when converting a hexadecimal string to a value. The example determines whether a value represents a signed or an unsigned integer while it is converting that value to its string representation. When the example converts the value to a value, it checks whether the original value was a signed integer. If so, and if its high-order bit is set (which indicates that the original value was negative), the method throws an exception. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToByte/Conversion.cs" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToByte/Conversion.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToByte/Conversion.vb" id="Snippet16"::: ## Examples The following example attempts to interpret each element in an array of numeric strings as a hexadecimal value and to convert it to an unsigned long integer. :::code language="csharp" source="~/snippets/csharp/System/Convert/ToUInt64/touint64_3.cs" id="Snippet16"::: :::code language="fsharp" source="~/snippets/fsharp/System/Convert/ToUInt64/touint64_3.fs" id="Snippet16"::: :::code language="vb" source="~/snippets/visualbasic/System/Convert/ToUInt64/touint64_3.vb" id="Snippet16"::: ]]> is not 2, 8, 10, or 16. -or- , which represents a non-base 10 unsigned number, is prefixed with a negative sign. is . contains a character that is not a valid digit in the base specified by . The exception message indicates that there are no digits to convert if the first character in is invalid; otherwise, the message indicates that contains invalid trailing characters. , which represents a non-base 10 unsigned number, is prefixed with a negative sign. -or- represents a number that is less than UInt64.MinValue or greater than UInt64.MaxValue. Method System.Runtime.Extensions 4.2.1.0 4.2.2.0 mscorlib netstandard 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean A span containing the string representation that is encoded with base-64 digits. The span in which to write the converted 8-bit unsigned integers. If this method returns , either the span remains unmodified or contains an incomplete conversion of , up to the last valid character. When this method returns, contains the number of bytes that were written in . Tries to convert the specified span containing a string representation that is encoded with base-64 digits into a span of 8-bit unsigned integers. if the conversion was successful; otherwise, . To be added. Method System.Runtime.Extensions 4.2.1.0 4.2.2.0 mscorlib netstandard 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean [System.Runtime.CompilerServices.Nullable(1)] [<System.Runtime.CompilerServices.Nullable(1)>] The string representation that is encoded with base-64 digits. The span in which to write the converted 8-bit unsigned integers. When this method returns , either the span remains unmodified or contains an incomplete conversion of , up to the last valid character. When this method returns, contains the number of bytes that were written in . Tries to convert the specified string representation that is encoded with base-64 digits into a span of 8-bit unsigned integers. if the conversion was successful; otherwise, . To be added. is . Method System.Runtime.Extensions 4.2.1.0 4.2.2.0 mscorlib netstandard 2.1.0.0 System.Runtime 5.0.0.0 6.0.0.0 7.0.0.0 8.0.0.0 9.0.0.0 10.0.0.0 11.0.0.0 System.Boolean A read-only span of 8-bit unsigned integers. The span in which to write the string representation in base 64 of the elements in . If the length of is 0, or when this method returns , nothing is written into this parameter. When this method returns, contains the total number of characters written into . One of the enumeration values that specify whether to insert line breaks in the return value. The default value is . Tries to convert the 8-bit unsigned integers inside the specified read-only span into their equivalent string representation that is encoded with base-64 digits. You can optionally specify whether to insert line breaks in the return value. if the conversion is successful; otherwise, . To be added. is not a valid value. Method System.Runtime 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.Boolean A span of 8-bit unsigned integers. The UTF-8 span representation in hex of the elements in . When this method returns, contains the number of bytes that were written in . Converts a span of 8-bit unsigned integers to its equivalent UTF-8 span representation that is encoded with uppercase hex characters. if the conversion was successful; otherwise, . To be added. Method System.Runtime 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.Boolean A span of 8-bit unsigned integers. The span representation in hex of the elements in . When this method returns, contains the number of chars that were written in . Converts a span of 8-bit unsigned integers to its equivalent span representation that is encoded with uppercase hex characters. if the conversion was successful; otherwise, . To be added. Method System.Runtime 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.Boolean A span of 8-bit unsigned integers. The UTF-8 span representation in hex of the elements in . When this method returns, contains the number of bytes that were written in . Converts a span of 8-bit unsigned integers to its equivalent UTF-8 span representation that is encoded with lowercase hex characters. if the conversion was successful; otherwise, . To be added. Method System.Runtime 9.0.0.0 10.0.0.0 11.0.0.0 System.Runtime.Extensions mscorlib netstandard System.Boolean A span of 8-bit unsigned integers. The span representation in hex of the elements in . When this method returns, contains the number of chars that were written in . Converts a span of 8-bit unsigned integers to its equivalent span representation that is encoded with lowercase hex characters. if the conversion was successful; otherwise, . To be added.