More API craziness
This is how you make a String from an array of bytes in .NET:
(I really, really dislike .NET's "always capitalise everything whether it's a package, class, constant or variable" naming convention. What a waste of an alphabet).
System.Text.Encoding encoding = System.Text.Encoding.UTF8;
return encoding.GetString (buffer);
This is how you do it in Java:
If you have an array of bytes that you want to stringify, then you'll likely go straight to the String class to see what kinds of things it can do with byte arrays. In .NET you need to find your way toreturn new String (buffer, "UTF-8");
System.Text.Encoding
and then work it out from there.
(I really, really dislike .NET's "always capitalise everything whether it's a package, class, constant or variable" naming convention. What a waste of an alphabet).
0 Comments:
Post a Comment
<< Home