Docs-.NET-C # - Guide - Language Reference - keyword - value types: char

ylbtech-Docs-.NET-C # - Guide - Language Reference - keyword - value types: char

 

1. Back to top
1、

char (C # Reference)

char Type the keyword is the .NET  System.Char  structure type alias that represents the Unicode UTF-16 characters :

Types of range size .NET type
char U+0000 到 U+FFFF # 16 System.Char

text

char Types of constants can be written as a character text, hexadecimal escape sequences or Unicode representationInteger character codes may be converted to the corresponding force  char values. In the following example, the same character  X of the  char four elements of the array are initialized:

C#
Var Chars = new  char [ 4 ];

chars[0] = 'X';        // Character literal
chars[1] = '\x0058';   // Hexadecimal
chars[2] = (char)88;   // Cast from integral type
chars[3] = '\u0058';   // Unicode

Console.Write(string.Join(" ", chars));
// Output: X X X X

Change

char Types implicitly converted to the integerushort type: int, uint, , long and  ulongIt may be implicitly built converted to floating point numeric types: float, double and  decimalIt can be explicitly converted to  sbyte, byte and  short integral type.

Other types can not be implicitly converted to  char type. However, any integer or floating point numeric type can be explicitly converted  char.

C # Language Specification

For more information, see the  C # language specification of integer type section.

See

2、
2. Return to top
 
3. Back to top
 
4. Top
 
5. Top
1、
2、
 
6. Back to top
 
warn Author: ylbtech
Source: http://ylbtech.cnblogs.com/
This article belongs to the author and blog Park total, welcome to reprint, but without the author's consent declared by this section must be retained, and given the original connection in the apparent position of the article page, otherwise reserves the right to pursue legal responsibilities.

Guess you like

Origin www.cnblogs.com/storebook/p/11846237.html