At work today I had to convert a file into a base64binary format. I found this
website which works well.
This got me to thinking that as I am learning (read very new) to C# it would be a good idea to try and build something similar as a general learning experience.
So I am going to do it initially as a console application which a user will be able to enter data (standard iso format) which it will then convert and output as base64binary.
I have started with this code:
Code:
string input1;
Console.WriteLine("please enter your name:");
input1 = Console.ReadLine();
Convert.ToBase64String(input1);
Console.WriteLine("{0}", input1);
Console.ReadKey();
This doesn't work however because:
Error 1 The best overloaded method match for 'System.Convert.ToBase64String(byte[])' has some invalid arguments C:\BegVCSharp\CodeSnippets\CodeSnippets\Program.cs 41 13 CodeSnippets
:Error 2 Argument '1': cannot convert from 'string' to 'byte[]' C:\BegVCSharp\CodeSnippets\CodeSnippets\Program.cs 41 36 CodeSnippets
After some reading up I understand the second error message I can't take a string format and implicitly convert it to a byte format which is what I have tried to do. However if I work on an explicit conversion is it possible to do this?
What is the best way for me to read numbers, letters and special characters and be able to convert them into base64binary? Am I going about this the right way and is a console application capable of acheiving this?
I want to work it out myself but a point in the right direction never hurt anyone ;-)
Cheers,