String length in bytes

Being lazy here...

How many bytes are used to store a string?

I would guess the (number of characters * 2) + 4

is that correct?

cheers

Guy
Guy [ Fr, 25 Januar 2008 11:32 ] [ ID #1915950 ]

Re: String length in bytes

guy <guy [at] discussions.microsoft.com> wrote:
> Being lazy here...
>
> How many bytes are used to store a string?
>
> I would guess the (number of characters * 2) + 4
>
> is that correct?

Well, where did you get the 4 from? I believe it's more like 12 or 16 -
but the basics are right.

--
Jon Skeet - <skeet [at] pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
skeet [ Fr, 25 Januar 2008 20:26 ] [ ID #1915970 ]

Re: String length in bytes

http://www.codeproject.com/KB/dotnet/strings.aspx

LP,
Dejan
Dejan Stanic [ Sa, 26 Januar 2008 00:01 ] [ ID #1915984 ]

Re: String length in bytes

Many thanks,

just what I needed!

Guy

"Dejan Stanic" wrote:

> http://www.codeproject.com/KB/dotnet/strings.aspx
>
> LP,
> Dejan
>
>
Guy [ Mi, 30 Januar 2008 09:20 ] [ ID #1919804 ]
Microsoft » microsoft.public.dotnet.general » String length in bytes

Vorheriges Thema: asp:Login question
Nächstes Thema: Works Spreadsheets