"Ole" <(E-Mail Removed)> wrote:
> By converting a string in a textbox to a byte array I'll need the byte size
> of the string - how to determine that?
What method are you using to convert? Every char in the string is two
bytes in size, so if you are just converting the chars directly and not
using any particular encoding, the answer is string.Length * 2.
However, if you are using an encoding, you can either call
Encoding.GetByteCount() or simply call one of the Encoding.GetBytes()
overloads which returns an array of the right length. E.g.:
---8<---
byte[] bytes = Encoding.UTF8.GetBytes("foo");
--->8---
-- Barry
--
http://barrkel.blogspot.com/