I have two functions which I seem to be including in software quite a lot to convert strings and byte arrays between types. The usage is something like this:
string str = "Hello world";
byte[] b = strToByteArray(str);
Firstly, is there a way I can include this in the System namespace so I don't have to define it in code anymore?
Secondly, is there a way to define it as part of the string class, so the usage would be more like:
string str = "Hello world";
byte[] b = str.ToByteArray();