string s = "test"; ushort[] result = s.ToCharArray().Select(c => (ushort)c).ToArray();
Not sure if this is the best way, but it should work.
Edit: I did not know the string implemented by IEnumerable . So you just need to:
ushort[] result = s.Select(c => (ushort)c).ToArray();
Thanks Jeff for pointing this out.
fearofawhackplanet
source share