mscorlib(4.0.0.0) API with additions
System.Char Struct Reference

Represents a character as a UTF-16 code unit. More...

Inheritance diagram for System.Char:
[legend]
Collaboration diagram for System.Char:
[legend]

Public Member Functions

override int GetHashCode ()
 Returns the hash code for this instance. More...
 
override bool Equals (object obj)
 Returns a value that indicates whether this instance is equal to a specified object. More...
 
bool Equals (char obj)
 Returns a value that indicates whether this instance is equal to the specified T:System.Char object. More...
 
int CompareTo (object value)
 Compares this instance to a specified object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified T:System.Object. More...
 
int CompareTo (char value)
 Compares this instance to a specified T:System.Char object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified T:System.Char object. More...
 
override string ToString ()
 Converts the value of this instance to its equivalent string representation. More...
 
string ToString (IFormatProvider provider)
 Converts the value of this instance to its equivalent string representation using the specified culture-specific format information. More...
 
TypeCode GetTypeCode ()
 Returns the T:System.TypeCode for value type T:System.Char. More...
 
bool IConvertible. ToBoolean (IFormatProvider provider)
 Note   This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException. More...
 
char IConvertible. ToChar (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToChar(System.IFormatProvider). More...
 
sbyte IConvertible. ToSByte (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToSByte(System.IFormatProvider). More...
 
byte IConvertible. ToByte (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToByte(System.IFormatProvider). More...
 
short IConvertible. ToInt16 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToInt16(System.IFormatProvider). More...
 
ushort IConvertible. ToUInt16 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToUInt16(System.IFormatProvider). More...
 
int IConvertible. ToInt32 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToInt32(System.IFormatProvider). More...
 
uint IConvertible. ToUInt32 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToUInt32(System.IFormatProvider). More...
 
long IConvertible. ToInt64 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToInt64(System.IFormatProvider). More...
 
ulong IConvertible. ToUInt64 (IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToUInt64(System.IFormatProvider). More...
 
float IConvertible. ToSingle (IFormatProvider provider)
 Note   This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException. More...
 
double IConvertible. ToDouble (IFormatProvider provider)
 Note   This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException. More...
 
decimal IConvertible. ToDecimal (IFormatProvider provider)
 Note   This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException. More...
 
DateTime IConvertible. ToDateTime (IFormatProvider provider)
 Note   This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException. More...
 
object IConvertible. ToType (Type type, IFormatProvider provider)
 For a description of this member, see M:System.IConvertible.ToType(System.Type,System.IFormatProvider). More...
 
- Public Member Functions inherited from System.IEquatable< char >
bool Equals (T other)
 Indicates whether the current object is equal to another object of the same type. More...
 

Static Public Member Functions

static string ToString (char c)
 Converts the specified Unicode character to its equivalent string representation. More...
 
static char Parse (string s)
 Converts the value of the specified string to its equivalent Unicode character. More...
 
static bool TryParse (string s, out char result)
 Converts the value of the specified string to its equivalent Unicode character. A return code indicates whether the conversion succeeded or failed. More...
 
static bool IsDigit (char c)
 Indicates whether the specified Unicode character is categorized as a decimal digit. More...
 
static internal bool CheckLetter (UnicodeCategory uc)
 
static bool IsLetter (char c)
 Indicates whether the specified Unicode character is categorized as a Unicode letter. More...
 
static bool IsWhiteSpace (char c)
 Indicates whether the specified Unicode character is categorized as white space. More...
 
static bool IsUpper (char c)
 Indicates whether the specified Unicode character is categorized as an uppercase letter. More...
 
static bool IsLower (char c)
 Indicates whether the specified Unicode character is categorized as a lowercase letter. More...
 
static internal bool CheckPunctuation (UnicodeCategory uc)
 
static bool IsPunctuation (char c)
 Indicates whether the specified Unicode character is categorized as a punctuation mark. More...
 
static internal bool CheckLetterOrDigit (UnicodeCategory uc)
 
static bool IsLetterOrDigit (char c)
 Indicates whether the specified Unicode character is categorized as a letter or a decimal digit. More...
 
static char ToUpper (char c, CultureInfo culture)
 Converts the value of a specified Unicode character to its uppercase equivalent using specified culture-specific formatting information. More...
 
static char ToUpper (char c)
 Converts the value of a Unicode character to its uppercase equivalent. More...
 
static char ToUpperInvariant (char c)
 Converts the value of a Unicode character to its uppercase equivalent using the casing rules of the invariant culture. More...
 
static char ToLower (char c, CultureInfo culture)
 Converts the value of a specified Unicode character to its lowercase equivalent using specified culture-specific formatting information. More...
 
static char ToLower (char c)
 Converts the value of a Unicode character to its lowercase equivalent. More...
 
static char ToLowerInvariant (char c)
 Converts the value of a Unicode character to its lowercase equivalent using the casing rules of the invariant culture. More...
 
static bool IsControl (char c)
 Indicates whether the specified Unicode character is categorized as a control character. More...
 
static bool IsControl (string s, int index)
 Indicates whether the character at the specified position in a specified string is categorized as a control character. More...
 
static bool IsDigit (string s, int index)
 Indicates whether the character at the specified position in a specified string is categorized as a decimal digit. More...
 
static bool IsLetter (string s, int index)
 Indicates whether the character at the specified position in a specified string is categorized as a Unicode letter. More...
 
static bool IsLetterOrDigit (string s, int index)
 Indicates whether the character at the specified position in a specified string is categorized as a letter or a decimal digit. More...
 
static bool IsLower (string s, int index)
 Indicates whether the character at the specified position in a specified string is categorized as a lowercase letter. More...
 
static internal bool CheckNumber (UnicodeCategory uc)
 
static bool IsNumber (char c)
 Indicates whether the specified Unicode character is categorized as a number. More...
 
static bool IsNumber (string s, int index)
 Indicates whether the character at the specified position in a specified string is categorized as a number. More...
 
static bool IsPunctuation (string s, int index)
 Indicates whether the character at the specified position in a specified string is categorized as a punctuation mark. More...
 
static internal bool CheckSeparator (UnicodeCategory uc)
 
static bool IsSeparator (char c)
 Indicates whether the specified Unicode character is categorized as a separator character. More...
 
static bool IsSeparator (string s, int index)
 Indicates whether the character at the specified position in a specified string is categorized as a separator character. More...
 
static bool IsSurrogate (char c)
 Indicates whether the specified character has a surrogate code unit. More...
 
static bool IsSurrogate (string s, int index)
 Indicates whether the character at the specified position in a specified string has a surrogate code unit. More...
 
static internal bool CheckSymbol (UnicodeCategory uc)
 
static bool IsSymbol (char c)
 Indicates whether the specified Unicode character is categorized as a symbol character. More...
 
static bool IsSymbol (string s, int index)
 Indicates whether the character at the specified position in a specified string is categorized as a symbol character. More...
 
static bool IsUpper (string s, int index)
 Indicates whether the character at the specified position in a specified string is categorized as an uppercase letter. More...
 
static bool IsWhiteSpace (string s, int index)
 Indicates whether the character at the specified position in a specified string is categorized as white space. More...
 
static UnicodeCategory GetUnicodeCategory (char c)
 Categorizes a specified Unicode character into a group identified by one of the T:System.Globalization.UnicodeCategory values. More...
 
static UnicodeCategory GetUnicodeCategory (string s, int index)
 Categorizes the character at the specified position in a specified string into a group identified by one of the T:System.Globalization.UnicodeCategory values. More...
 
static double GetNumericValue (char c)
 Converts the specified numeric Unicode character to a double-precision floating point number. More...
 
static double GetNumericValue (string s, int index)
 Converts the numeric Unicode character at the specified position in a specified string to a double-precision floating point number. More...
 
static bool IsHighSurrogate (char c)
 Indicates whether the specified T:System.Char object is a high surrogate. More...
 
static bool IsHighSurrogate (string s, int index)
 Indicates whether the T:System.Char object at the specified position in a string is a high surrogate. More...
 
static bool IsLowSurrogate (char c)
 Indicates whether the specified T:System.Char object is a low surrogate. More...
 
static bool IsLowSurrogate (string s, int index)
 Indicates whether the T:System.Char object at the specified position in a string is a low surrogate. More...
 
static bool IsSurrogatePair (string s, int index)
 Indicates whether two adjacent T:System.Char objects at a specified position in a string form a surrogate pair. More...
 
static bool IsSurrogatePair (char highSurrogate, char lowSurrogate)
 Indicates whether the two specified T:System.Char objects form a surrogate pair. More...
 
static string ConvertFromUtf32 (int utf32)
 Converts the specified Unicode code point into a UTF-16 encoded string. More...
 
static int ConvertToUtf32 (char highSurrogate, char lowSurrogate)
 Converts the value of a UTF-16 encoded surrogate pair into a Unicode code point. More...
 
static int ConvertToUtf32 (string s, int index)
 Converts the value of a UTF-16 encoded character or surrogate pair at a specified position in a string into a Unicode code point. More...
 

Public Attributes

internal char m_value
 
const char MaxValue = '\uffff'
 Represents the largest possible value of a T:System.Char. This field is constant. More...
 
const char MinValue = '\0'
 Represents the smallest possible value of a T:System.Char. This field is constant. More...
 
internal const int UNICODE_PLANE00_END = 65535
 
internal const int UNICODE_PLANE01_START = 65536
 
internal const int UNICODE_PLANE16_END = 1114111
 
internal const int HIGH_SURROGATE_START = 55296
 
internal const int LOW_SURROGATE_END = 57343
 

Detailed Description

Represents a character as a UTF-16 code unit.

Definition at line 11 of file Char.cs.

Member Function Documentation

◆ CompareTo() [1/2]

int System.Char.CompareTo ( object  value)

Compares this instance to a specified object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified T:System.Object.

Parameters
valueAn object to compare this instance to, or null.
Returns
A signed number indicating the position of this instance in the sort order in relation to the value parameter.Return Value Description Less than zero This instance precedes value . Zero This instance has the same position in the sort order as value . Greater than zero This instance follows value .-or- value is null.
Exceptions
T:System.ArgumentExceptionvalue is not a T:System.Char object.

Definition at line 347 of file Char.cs.

◆ CompareTo() [2/2]

int System.Char.CompareTo ( char  value)

Compares this instance to a specified T:System.Char object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified T:System.Char object.

Parameters
valueA T:System.Char object to compare.
Returns
A signed number indicating the position of this instance in the sort order in relation to the value parameter.Return Value Description Less than zero This instance precedes value . Zero This instance has the same position in the sort order as value . Greater than zero This instance follows value .

Definition at line 364 of file Char.cs.

◆ ConvertFromUtf32()

static string System.Char.ConvertFromUtf32 ( int  utf32)
static

Converts the specified Unicode code point into a UTF-16 encoded string.

Parameters
utf32A 21-bit Unicode code point.
Returns
A string consisting of one T:System.Char object or a surrogate pair of T:System.Char objects equivalent to the code point specified by the utf32 parameter.
Exceptions
T:System.ArgumentOutOfRangeExceptionutf32 is not a valid 21-bit Unicode code point ranging from U+0 through U+10FFFF, excluding the surrogate pair range from U+D800 through U+DFFF.

Definition at line 1543 of file Char.cs.

◆ ConvertToUtf32() [1/2]

static int System.Char.ConvertToUtf32 ( char  highSurrogate,
char  lowSurrogate 
)
static

Converts the value of a UTF-16 encoded surrogate pair into a Unicode code point.

Parameters
highSurrogateA high surrogate code unit (that is, a code unit ranging from U+D800 through U+DBFF).
lowSurrogateA low surrogate code unit (that is, a code unit ranging from U+DC00 through U+DFFF).
Returns
The 21-bit Unicode code point represented by the highSurrogate and lowSurrogate parameters.
Exceptions
T:System.ArgumentOutOfRangeExceptionhighSurrogate is not in the range U+D800 through U+DBFF, or lowSurrogate is not in the range U+DC00 through U+DFFF.

Definition at line 1568 of file Char.cs.

◆ ConvertToUtf32() [2/2]

static int System.Char.ConvertToUtf32 ( string  s,
int  index 
)
static

Converts the value of a UTF-16 encoded character or surrogate pair at a specified position in a string into a Unicode code point.

Parameters
sA string that contains a character or surrogate pair.
indexThe index position of the character or surrogate pair in s .
Returns
The 21-bit Unicode code point represented by the character or surrogate pair at the position in the s parameter specified by the index parameter.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is not a position within s .
T:System.ArgumentExceptionThe specified index position contains a surrogate pair, and either the first character in the pair is not a valid high surrogate or the second character in the pair is not a valid low surrogate.

Definition at line 1591 of file Char.cs.

◆ Equals() [1/2]

override bool System.Char.Equals ( object  obj)

Returns a value that indicates whether this instance is equal to a specified object.

Parameters
objAn object to compare with this instance or null.
Returns
true if obj is an instance of T:System.Char and equals the value of this instance; otherwise, false.

Definition at line 321 of file Char.cs.

◆ Equals() [2/2]

bool System.Char.Equals ( char  obj)

Returns a value that indicates whether this instance is equal to the specified T:System.Char object.

Parameters
objAn object to compare to this instance.
Returns
true if the obj parameter equals the value of this instance; otherwise, false.

Definition at line 336 of file Char.cs.

◆ GetHashCode()

override int System.Char.GetHashCode ( )

Returns the hash code for this instance.

Returns
A 32-bit signed integer hash code.

Definition at line 311 of file Char.cs.

◆ GetNumericValue() [1/2]

static double System.Char.GetNumericValue ( char  c)
static

Converts the specified numeric Unicode character to a double-precision floating point number.

Parameters
cThe Unicode character to convert.
Returns
The numeric value of c if that character represents a number; otherwise, -1.0.

Definition at line 1390 of file Char.cs.

◆ GetNumericValue() [2/2]

static double System.Char.GetNumericValue ( string  s,
int  index 
)
static

Converts the numeric Unicode character at the specified position in a specified string to a double-precision floating point number.

Parameters
sA T:System.String.
indexThe character position in s .
Returns
The numeric value of the character at position index in s if that character represents a number; otherwise, -1.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 1404 of file Char.cs.

◆ GetTypeCode()

TypeCode System.Char.GetTypeCode ( )

Returns the T:System.TypeCode for value type T:System.Char.

Returns
The enumerated constant, F:System.TypeCode.Char.

Implements System.IConvertible.

Definition at line 702 of file Char.cs.

◆ GetUnicodeCategory() [1/2]

static UnicodeCategory System.Char.GetUnicodeCategory ( char  c)
static

Categorizes a specified Unicode character into a group identified by one of the T:System.Globalization.UnicodeCategory values.

Parameters
cThe Unicode character to categorize.
Returns
A T:System.Globalization.UnicodeCategory value that identifies the group that contains c .

Definition at line 1352 of file Char.cs.

◆ GetUnicodeCategory() [2/2]

static UnicodeCategory System.Char.GetUnicodeCategory ( string  s,
int  index 
)
static

Categorizes the character at the specified position in a specified string into a group identified by one of the T:System.Globalization.UnicodeCategory values.

Parameters
sA T:System.String.
indexThe character position in s .
Returns
A T:System.Globalization.UnicodeCategory enumerated constant that identifies the group that contains the character at position index in s .
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 1369 of file Char.cs.

◆ IsControl() [1/2]

static bool System.Char.IsControl ( char  c)
static

Indicates whether the specified Unicode character is categorized as a control character.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a control character; otherwise, false.

Definition at line 861 of file Char.cs.

◆ IsControl() [2/2]

static bool System.Char.IsControl ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string is categorized as a control character.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is a control character; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 880 of file Char.cs.

◆ IsDigit() [1/2]

static bool System.Char.IsDigit ( char  c)
static

Indicates whether the specified Unicode character is categorized as a decimal digit.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a decimal digit; otherwise, false.

Definition at line 440 of file Char.cs.

◆ IsDigit() [2/2]

static bool System.Char.IsDigit ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string is categorized as a decimal digit.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is a decimal digit; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 908 of file Char.cs.

◆ IsHighSurrogate() [1/2]

static bool System.Char.IsHighSurrogate ( char  c)
static

Indicates whether the specified T:System.Char object is a high surrogate.

Parameters
cThe Unicode character to evaluate.
Returns
true if the numeric value of the c parameter ranges from U+D800 through U+DBFF; otherwise, false.

Definition at line 1422 of file Char.cs.

◆ IsHighSurrogate() [2/2]

static bool System.Char.IsHighSurrogate ( string  s,
int  index 
)
static

Indicates whether the T:System.Char object at the specified position in a string is a high surrogate.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the numeric value of the specified character in the s parameter ranges from U+D800 through U+DBFF; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is not a position within s .

Definition at line 1441 of file Char.cs.

◆ IsLetter() [1/2]

static bool System.Char.IsLetter ( char  c)
static

Indicates whether the specified Unicode character is categorized as a Unicode letter.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a letter; otherwise, false.

Definition at line 473 of file Char.cs.

◆ IsLetter() [2/2]

static bool System.Char.IsLetter ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string is categorized as a Unicode letter.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is a letter; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 940 of file Char.cs.

◆ IsLetterOrDigit() [1/2]

static bool System.Char.IsLetterOrDigit ( char  c)
static

Indicates whether the specified Unicode character is categorized as a letter or a decimal digit.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a letter or a decimal digit; otherwise, false.

Definition at line 621 of file Char.cs.

◆ IsLetterOrDigit() [2/2]

static bool System.Char.IsLetterOrDigit ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string is categorized as a letter or a decimal digit.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is a letter or a decimal digit; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 977 of file Char.cs.

◆ IsLower() [1/2]

static bool System.Char.IsLower ( char  c)
static

Indicates whether the specified Unicode character is categorized as a lowercase letter.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a lowercase letter; otherwise, false.

Definition at line 552 of file Char.cs.

◆ IsLower() [2/2]

static bool System.Char.IsLower ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string is categorized as a lowercase letter.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is a lowercase letter; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 1005 of file Char.cs.

◆ IsLowSurrogate() [1/2]

static bool System.Char.IsLowSurrogate ( char  c)
static

Indicates whether the specified T:System.Char object is a low surrogate.

Parameters
cThe character to evaluate.
Returns
true if the numeric value of the c parameter ranges from U+DC00 through U+DFFF; otherwise, false.

Definition at line 1459 of file Char.cs.

◆ IsLowSurrogate() [2/2]

static bool System.Char.IsLowSurrogate ( string  s,
int  index 
)
static

Indicates whether the T:System.Char object at the specified position in a string is a low surrogate.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the numeric value of the specified character in the s parameter ranges from U+DC00 through U+DFFF; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is not a position within s .

Definition at line 1478 of file Char.cs.

◆ IsNumber() [1/2]

static bool System.Char.IsNumber ( char  c)
static

Indicates whether the specified Unicode character is categorized as a number.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a number; otherwise, false.

Definition at line 1049 of file Char.cs.

◆ IsNumber() [2/2]

static bool System.Char.IsNumber ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string is categorized as a number.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is a number; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 1076 of file Char.cs.

◆ IsPunctuation() [1/2]

static bool System.Char.IsPunctuation ( char  c)
static

Indicates whether the specified Unicode character is categorized as a punctuation mark.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a punctuation mark; otherwise, false.

Definition at line 591 of file Char.cs.

◆ IsPunctuation() [2/2]

static bool System.Char.IsPunctuation ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string is categorized as a punctuation mark.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is a punctuation mark; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 1112 of file Char.cs.

◆ IsSeparator() [1/2]

static bool System.Char.IsSeparator ( char  c)
static

Indicates whether the specified Unicode character is categorized as a separator character.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a separator character; otherwise, false.

Definition at line 1157 of file Char.cs.

◆ IsSeparator() [2/2]

static bool System.Char.IsSeparator ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string is categorized as a separator character.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is a separator character; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 1176 of file Char.cs.

◆ IsSurrogate() [1/2]

static bool System.Char.IsSurrogate ( char  c)
static

Indicates whether the specified character has a surrogate code unit.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is either a high surrogate or a low surrogate; otherwise, false.

Definition at line 1199 of file Char.cs.

◆ IsSurrogate() [2/2]

static bool System.Char.IsSurrogate ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string has a surrogate code unit.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is a either a high surrogate or a low surrogate; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 1218 of file Char.cs.

◆ IsSurrogatePair() [1/2]

static bool System.Char.IsSurrogatePair ( string  s,
int  index 
)
static

Indicates whether two adjacent T:System.Char objects at a specified position in a string form a surrogate pair.

Parameters
sA string.
indexThe starting position of the pair of characters to evaluate within s .
Returns
true if the s parameter includes adjacent characters at positions index and index + 1, and the numeric value of the character at position index ranges from U+D800 through U+DBFF, and the numeric value of the character at position index +1 ranges from U+DC00 through U+DFFF; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is not a position within s .

Definition at line 1501 of file Char.cs.

◆ IsSurrogatePair() [2/2]

static bool System.Char.IsSurrogatePair ( char  highSurrogate,
char  lowSurrogate 
)
static

Indicates whether the two specified T:System.Char objects form a surrogate pair.

Parameters
highSurrogateThe character to evaluate as the high surrogate of a surrogate pair.
lowSurrogateThe character to evaluate as the low surrogate of a surrogate pair.
Returns
true if the numeric value of the highSurrogate parameter ranges from U+D800 through U+DBFF, and the numeric value of the lowSurrogate parameter ranges from U+DC00 through U+DFFF; otherwise, false.

Definition at line 1524 of file Char.cs.

◆ IsSymbol() [1/2]

static bool System.Char.IsSymbol ( char  c)
static

Indicates whether the specified Unicode character is categorized as a symbol character.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is a symbol character; otherwise, false.

Definition at line 1250 of file Char.cs.

◆ IsSymbol() [2/2]

static bool System.Char.IsSymbol ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string is categorized as a symbol character.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is a symbol character; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 1269 of file Char.cs.

◆ IsUpper() [1/2]

static bool System.Char.IsUpper ( char  c)
static

Indicates whether the specified Unicode character is categorized as an uppercase letter.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is an uppercase letter; otherwise, false.

Definition at line 530 of file Char.cs.

◆ IsUpper() [2/2]

static bool System.Char.IsUpper ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string is categorized as an uppercase letter.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is an uppercase letter; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 1296 of file Char.cs.

◆ IsWhiteSpace() [1/2]

static bool System.Char.IsWhiteSpace ( char  c)
static

Indicates whether the specified Unicode character is categorized as white space.

Parameters
cThe Unicode character to evaluate.
Returns
true if c is white space; otherwise, false.

Definition at line 516 of file Char.cs.

◆ IsWhiteSpace() [2/2]

static bool System.Char.IsWhiteSpace ( string  s,
int  index 
)
static

Indicates whether the character at the specified position in a specified string is categorized as white space.

Parameters
sA string.
indexThe position of the character to evaluate in s .
Returns
true if the character at position index in s is white space; otherwise, false.
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.ArgumentOutOfRangeExceptionindex is less than zero or greater than the last position in s .

Definition at line 1332 of file Char.cs.

◆ Parse()

static char System.Char.Parse ( string  s)
static

Converts the value of the specified string to its equivalent Unicode character.

Parameters
sA string that contains a single character, or null.
Returns
A Unicode character equivalent to the sole character in s .
Exceptions
T:System.ArgumentNullExceptions is null.
T:System.FormatExceptionThe length of s is not 1.

Definition at line 401 of file Char.cs.

◆ ToBoolean()

bool IConvertible. System.Char.ToBoolean ( IFormatProvider  provider)

Note   This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException.

Parameters
providerThis parameter is ignored.
Returns
This conversion is not supported. No value is returned.
Exceptions
T:System.InvalidCastExceptionThis conversion is not supported.

Implements System.IConvertible.

Definition at line 713 of file Char.cs.

◆ ToByte()

byte IConvertible. System.Char.ToByte ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToByte(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The converted value of the current T:System.Char object.

Implements System.IConvertible.

Definition at line 740 of file Char.cs.

◆ ToChar()

char IConvertible. System.Char.ToChar ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToChar(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The value of the current T:System.Char object unchanged.

Implements System.IConvertible.

Definition at line 722 of file Char.cs.

◆ ToDateTime()

DateTime IConvertible. System.Char.ToDateTime ( IFormatProvider  provider)

Note   This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException.

Parameters
providerThis parameter is ignored.
Returns
No value is returned.
Exceptions
T:System.InvalidCastExceptionThis conversion is not supported.

Implements System.IConvertible.

Definition at line 838 of file Char.cs.

◆ ToDecimal()

decimal IConvertible. System.Char.ToDecimal ( IFormatProvider  provider)

Note   This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException.

Parameters
providerThis parameter is ignored.
Returns
No value is returned.
Exceptions
T:System.InvalidCastExceptionThis conversion is not supported.

Implements System.IConvertible.

Definition at line 827 of file Char.cs.

◆ ToDouble()

double IConvertible. System.Char.ToDouble ( IFormatProvider  provider)

Note   This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException.

Parameters
providerThis parameter is ignored.
Returns
No value is returned.
Exceptions
T:System.InvalidCastExceptionThis conversion is not supported.

Implements System.IConvertible.

Definition at line 816 of file Char.cs.

◆ ToInt16()

short IConvertible. System.Char.ToInt16 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToInt16(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The converted value of the current T:System.Char object.

Implements System.IConvertible.

Definition at line 749 of file Char.cs.

◆ ToInt32()

int IConvertible. System.Char.ToInt32 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToInt32(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The converted value of the current T:System.Char object.

Implements System.IConvertible.

Definition at line 767 of file Char.cs.

◆ ToInt64()

long IConvertible. System.Char.ToInt64 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToInt64(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The converted value of the current T:System.Char object.

Implements System.IConvertible.

Definition at line 785 of file Char.cs.

◆ ToLower() [1/2]

static char System.Char.ToLower ( char  c,
CultureInfo  culture 
)
static

Converts the value of a specified Unicode character to its lowercase equivalent using specified culture-specific formatting information.

Parameters
cThe Unicode character to convert.
cultureAn object that supplies culture-specific casing rules.
Returns
The lowercase equivalent of c , modified according to culture , or the unchanged value of c , if c is already lowercase or not alphabetic.
Exceptions
T:System.ArgumentNullExceptionculture is null.

Definition at line 673 of file Char.cs.

◆ ToLower() [2/2]

static char System.Char.ToLower ( char  c)
static

Converts the value of a Unicode character to its lowercase equivalent.

Parameters
cThe Unicode character to convert.
Returns
The lowercase equivalent of c , or the unchanged value of c , if c is already lowercase or not alphabetic.

Definition at line 686 of file Char.cs.

◆ ToLowerInvariant()

static char System.Char.ToLowerInvariant ( char  c)
static

Converts the value of a Unicode character to its lowercase equivalent using the casing rules of the invariant culture.

Parameters
cThe Unicode character to convert.
Returns
The lowercase equivalent of the c parameter, or the unchanged value of c , if c is already lowercase or not alphabetic.

Definition at line 695 of file Char.cs.

◆ ToSByte()

sbyte IConvertible. System.Char.ToSByte ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToSByte(System.IFormatProvider).

Parameters
providerThis parameter is ignored.
Returns
The converted value of the current T:System.Char object.

Implements System.IConvertible.

Definition at line 731 of file Char.cs.

◆ ToSingle()

float IConvertible. System.Char.ToSingle ( IFormatProvider  provider)

Note   This conversion is not supported. Attempting to do so throws an T:System.InvalidCastException.

Parameters
providerThis parameter is ignored.
Returns
No value is returned.
Exceptions
T:System.InvalidCastExceptionThis conversion is not supported.

Implements System.IConvertible.

Definition at line 805 of file Char.cs.

◆ ToString() [1/3]

override string System.Char.ToString ( )

Converts the value of this instance to its equivalent string representation.

Returns
The string representation of the value of this instance.

Definition at line 372 of file Char.cs.

◆ ToString() [2/3]

string System.Char.ToString ( IFormatProvider  provider)

Converts the value of this instance to its equivalent string representation using the specified culture-specific format information.

Parameters
provider(Reserved) An object that supplies culture-specific formatting information.
Returns
The string representation of the value of this instance as specified by provider .

Implements System.IConvertible.

Definition at line 380 of file Char.cs.

◆ ToString() [3/3]

static string System.Char.ToString ( char  c)
static

Converts the specified Unicode character to its equivalent string representation.

Parameters
cThe Unicode character to convert.
Returns
The string representation of the value of c .

Definition at line 389 of file Char.cs.

◆ ToType()

object IConvertible. System.Char.ToType ( Type  type,
IFormatProvider  provider 
)

For a description of this member, see M:System.IConvertible.ToType(System.Type,System.IFormatProvider).

Parameters
typeA T:System.Type object.
providerAn T:System.IFormatProvider object.
Returns
An object of the specified type.
Exceptions
T:System.ArgumentNullExceptiontype is null.
T:System.InvalidCastExceptionThe value of the current T:System.Char object cannot be converted to the type specified by the type parameter.

Implements System.IConvertible.

Definition at line 851 of file Char.cs.

◆ ToUInt16()

ushort IConvertible. System.Char.ToUInt16 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToUInt16(System.IFormatProvider).

Parameters
providerAn T:System.IFormatProvider object. (Specify null because the provider parameter is ignored.)
Returns
The converted value of the current T:System.Char object.

Implements System.IConvertible.

Definition at line 758 of file Char.cs.

◆ ToUInt32()

uint IConvertible. System.Char.ToUInt32 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToUInt32(System.IFormatProvider).

Parameters
providerAn T:System.IFormatProvider object. (Specify null because the provider parameter is ignored.)
Returns
The converted value of the current T:System.Char object.

Implements System.IConvertible.

Definition at line 776 of file Char.cs.

◆ ToUInt64()

ulong IConvertible. System.Char.ToUInt64 ( IFormatProvider  provider)

For a description of this member, see M:System.IConvertible.ToUInt64(System.IFormatProvider).

Parameters
providerAn T:System.IFormatProvider object. (Specify null because the provider parameter is ignored.)
Returns
The converted value of the current T:System.Char object.

Implements System.IConvertible.

Definition at line 794 of file Char.cs.

◆ ToUpper() [1/2]

static char System.Char.ToUpper ( char  c,
CultureInfo  culture 
)
static

Converts the value of a specified Unicode character to its uppercase equivalent using specified culture-specific formatting information.

Parameters
cThe Unicode character to convert.
cultureAn object that supplies culture-specific casing rules.
Returns
The uppercase equivalent of c , modified according to culture , or the unchanged value of c if c is already uppercase, has no uppercase equivalent, or is not alphabetic.
Exceptions
T:System.ArgumentNullExceptionculture is null.

Definition at line 638 of file Char.cs.

◆ ToUpper() [2/2]

static char System.Char.ToUpper ( char  c)
static

Converts the value of a Unicode character to its uppercase equivalent.

Parameters
cThe Unicode character to convert.
Returns
The uppercase equivalent of c , or the unchanged value of c if c is already uppercase, has no uppercase equivalent, or is not alphabetic.

Definition at line 651 of file Char.cs.

◆ ToUpperInvariant()

static char System.Char.ToUpperInvariant ( char  c)
static

Converts the value of a Unicode character to its uppercase equivalent using the casing rules of the invariant culture.

Parameters
cThe Unicode character to convert.
Returns
The uppercase equivalent of the c parameter, or the unchanged value of c , if c is already uppercase or not alphabetic.

Definition at line 660 of file Char.cs.

◆ TryParse()

static bool System.Char.TryParse ( string  s,
out char  result 
)
static

Converts the value of the specified string to its equivalent Unicode character. A return code indicates whether the conversion succeeded or failed.

Parameters
sA string that contains a single character, or null.
resultWhen this method returns, contains a Unicode character equivalent to the sole character in s , if the conversion succeeded, or an undefined value if the conversion failed. The conversion fails if the s parameter is null or the length of s is not 1. This parameter is passed uninitialized.
Returns
true if the s parameter was converted successfully; otherwise, false.

Definition at line 420 of file Char.cs.

Member Data Documentation

◆ MaxValue

const char System.Char.MaxValue = '\uffff'

Represents the largest possible value of a T:System.Char. This field is constant.

Definition at line 17 of file Char.cs.

◆ MinValue

const char System.Char.MinValue = '\0'

Represents the smallest possible value of a T:System.Char. This field is constant.

Definition at line 21 of file Char.cs.


The documentation for this struct was generated from the following file: