Convert::ToBase64String Method (array<Byte>^)
Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits.
Assembly: mscorlib (in mscorlib.dll)
The elements of inArray are taken as a numeric value and converted to a string representation that is encoded with base-64 digits.
The base-64 digits in ascending order from zero are the uppercase characters "A" to "Z", the lowercase characters "a" to "z", the numerals "0" to "9", and the symbols "+" and "/". The valueless character, "=", is used for trailing padding.
Ordinarily, the ToBase64String method is not used to round-trip a UUEncoded (base-64 encoded) string. That is, if you decode a string by calling the FromBase64String method, then encode the returned byte array by calling the ToBase64String 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.
The following example uses the FromBase64String(String^) method to restore the original byte array.method to convert a byte array to a UUencoded (base-64) string, and then calls the
The following is a more complex example that creates a 20-element array of 32-bit integers. It then uses the BitConverter::GetBytes(Int32) method to convert each element into a byte array, which it stores in the appropriate position in a buffer by calling the Array::Copy(Array^, Int32, Array^, Int32, Int32) method. This buffer is then passed to the method to create a UUencoded (base-64) string. It then calls the FromBase64String(String^) method to decode the UUencoded string, and calls the BitConverter::ToInt32 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.
Available since 8
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Available since 8.1