A char in C# is

Skill/Topic: Beginner
A) 8 bit
B) 16 bit
C) 32 bit
Explanation: Unicode characters are supported in C#

Showing Answers 1 - 2 of 2 Answers

aeomer

  • Nov 6th, 2006
 

A char in c# is a 16 bit character from 0x0000 to 0xffff. However, it is not enough to state the reason for this is UNICODE.Reason:UNICODE is capable of accessing far more than 65536 characters. In point of fact there are more than 100,000 characters currently defined by the Unicode standard; if we include character composition then this number is far higher.With C# a choice was made to use UTF-16 (a form of UNICODE that assumes 16-bit for basic character composition) rather than UTF-8 as in Java. Both Java and C# can access all unicode characters as, unlike ASCII where a single code represents a single character, UNICODE can string together bytes to represent a character. Technically this means UTF-8 can use up to three bytes to describe a precomposed character and as many bytes as it wishes to compose a custom character. UTF-16 uses up to four bytes to select a precomposed character, but as many bytes (div by 2) to compose a custom character.There are other UNICODE composition rules that allow for UTF2 (another name for UTF16), UTF-7, UTF-8, UTF-16,UTF24, and UTF-32.Conclusion: c# chars are 16-bit, but only because Microsoft's internal character generation system is optimised for UTF-16. Just saying, "Oh, it's because of UNICODE" is not a good enough answer.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions