I need very fast conversion from byte array to string. Byte array is Unicode string.

I need very fast conversion from byte array to string. Byte array is Unicode string.

From byte[] array to string
var mystring = Encoding.Unicode.GetString(myarray);
From string to byte[]
var myarray2 = Encoding.Unicode.GetBytes(mystring);
var type?var isn't a type. It's an abbreviation for "the type of the right-hand expression" (so string) (see for example stackoverflow.com/questions/41479/use-of-var-keyword-in-c-sharp )var in JavaScript is not a type like you're saying. var in JavaScript is a keyword meaning I'm wanting to declare a variable here which type is inferred later.Encoding.ASCII.GetString instead of Encoding.Unicode.GetString in my case to get it to work.Try this
System.Text.UnicodeEncoding.Unicode.GetString
Convert.ToBase64String - why is that?UTF8 (I think you mean "UTF8" instead of "Unicode"). Because, U'll get just Chinese Symbols. ;)
Maybe it helps to change...
var mystring = Encoding.Unicode.GetString(myarray);
...to...
var mystring = Encoding.UTF8.GetString(myarray);
:)