Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

struct System.​Char

Assembly: System.Runtime

Represents a character as a UTF-16 code unit.

Fields and Constants

public const char
MaxValue
Represents the largest possible value of a <see cref="T:System.Char" /> . This field is constant.
public const char
MinValue
Represents the smallest possible value of a <see cref="T:System.Char" /> . This field is constant.

Methods

public int
CompareTo​(char value)
value A <see cref="T:System.Char" /> object to compare.
Returns A signed number indicating the position of this instance in the sort order in relation to the <paramref name="value" /> parameter. <list type="table"> <listheader> <term> Return Value</term> <description> Description</description> </listheader> <item> <term> Less than zero</term> <description> This instance precedes <paramref name="value" />.</description> </item> <item> <term> Zero</term> <description> This instance has the same position in the sort order as <paramref name="value" />.</description> </item> <item> <term> Greater than zero</term> <description> This instance follows <paramref name="value" />.</description> </item> </list>
Compares this instance to a specified <see cref="T:System.Char" /> object and indicates whether this instance precedes, follows, or appears in the same position in the sort order as the specified <see cref="T:System.Char" /> object.
public int
CompareTo​(object value)
value An object to compare this instance to, or <see langword="null" /> .
Returns A signed number indicating the position of this instance in the sort order in relation to the <paramref name="value" /> parameter. <list type="table"> <listheader> <term> Return Value</term> <description> Description</description> </listheader> <item> <term> Less than zero</term> <description> This instance precedes <paramref name="value" />.</description> </item> <item> <term> Zero</term> <description> This instance has the same position in the sort order as <paramref name="value" />.</description> </item> <item> <term> Greater than zero</term> <description> This instance follows <paramref name="value" />. -or- <paramref name="value" /> is <see langword="null" />.</description> </item> </list>
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 <see cref="T:System.Object" /> .
public bool
Equals​(char obj)
obj An object to compare to this instance.
Returns <see langword="true" /> if the <paramref name="obj" /> parameter equals the value of this instance; otherwise, <see langword="false" /> .
Returns a value that indicates whether this instance is equal to the specified <see cref="T:System.Char" /> object.
public bool
Equals​(object obj)
obj An object to compare with this instance or <see langword="null" /> .
Returns <see langword="true" /> if <paramref name="obj" /> is an instance of <see cref="T:System.Char" /> and equals the value of this instance; otherwise, <see langword="false" /> .
Returns a value that indicates whether this instance is equal to a specified object.
public int
GetHashCode​()
Returns A 32-bit signed integer hash code.
Returns the hash code for this instance.
public TypeCode
GetTypeCode​()
Returns The enumerated constant, <see cref="F:System.TypeCode.Char" /> .
Returns the <see cref="T:System.TypeCode" /> for value type <see cref="T:System.Char" /> .
public string
ToString​()
Returns The string representation of the value of this instance.
Converts the value of this instance to its equivalent string representation.
public string
ToString​(IFormatProvider provider)
provider (Reserved) An object that supplies culture-specific formatting information.
Returns The string representation of the value of this instance as specified by <paramref name="provider" /> .
Converts the value of this instance to its equivalent string representation using the specified culture-specific format information.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates a shallow copy of the current <see cref="T:System.Object" /> .