Code Snippets for common operations

1. read all the contents of a File

string output = File.ReadAllText(<FilePath>);

2. Write contents to a File

File.WriteAllText(<FilePath>,Encoding);

3. Convert String to Byte Array

byte[] buf = System.Text.Encoding.<Encoding>.GetBytes(string);

4. Convert Byte to String

string output = System.Text.Encoding.<Encoding>.GetString(byte[]);