Encoding.GetCharCount Method (Byte*, Int32)
Assembly: mscorlib (in mscorlib.dll)
[ComVisibleAttribute(false)] [CLSCompliantAttribute(false)] public: virtual int GetCharCount ( unsigned char* bytes, int count )
Not applicable.
Parameters
- bytes
A pointer to the first byte to decode.
- count
The number of bytes to decode.
Return Value
The number of characters produced by decoding the specified sequence of bytes.| Exception type | Condition |
|---|---|
| bytes is a null reference (Nothing in Visual Basic). | |
| count is less than zero. | |
| A fallback occurred (see Understanding Encodings for complete explanation) -and- DecoderFallback is set to DecoderExceptionFallback. |
To calculate the exact array size that GetChars requires to store the resulting characters, the application should use GetCharCount. To calculate the maximum array size, the application should use GetMaxCharCount. The GetCharCount method generally allows allocation of less memory, while the GetMaxCharCount method generally executes faster.
For a discussion of programming considerations for use of this method, see the Encoding class description.
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.