- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Convert.FromBase64String(String) Method in C#
The Convert.FromBase64String(String) method in C# converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.
Syntax
Following is the syntax −
public static byte[] FromBase64String (string str);
Above, the parameter str is the string to convert.
Example
Let us now see an example to implement the Convert.FromBase64String(String) method −
using System; public class Demo { public static void Main(){ byte[] val1 = {5,10,15,20,25,30}; string str = Convert.ToBase64String(val1); Console.WriteLine("Base 64 string: '{0}'", str); byte[] val2 = Convert.FromBase64String(str); Console.WriteLine("Converted byte value: {0}", BitConverter.ToString(val2)); } }
Output
This will produce the following output −
Base 64 string: 'BQoPFBke' Converted byte value: 05-0A-0F-14-19-1E
Advertisements