// ,
// Char.
using System;
using System.Globalization;
class CharDemo {
static void Main() {
string str = " . $23"; int i;
for(i=0; i < str.Length; i++) {
Console.Write(str[i] + " "); if(Char.IsDigit(str[i]))
Console.Write(" "); if(Char.IsLetter(str[i]))
Console.Write(" "); if(Char.IsLower(str [i]))
Console.Write(" "); if(Char.IsUpper(str[i]))
Console.Write(" "); if(Char.IsSymbol(str[i]))
Console.Write(" "); if(Char.IsSeparator (str[i]))
Console.Write(" "); if(Char.IsWhiteSpace (str [i]))
Console.Write(" "); if(Char.IsPunctuation(str [i]))
Console.Write(" ");
Console.WriteLine(" : " + str);
// .
string newstr = "";
for(i=0; i < str.Length; i++)
newstr += Char.ToUpper (str[i], Culturelnfo.CurrentCulture);
Console.WriteLine(" : " + newstr);
}
}
.
.
$
: . $23 : . $23
Boolean
Boolean bool. , , . 21.10. , .
Public static readonly string FalseString public static readonly string TrueString
true false . , FalseString - WriteLine (), "False".
Boolean : I Comp able, IComparable<bool>, IConvertible IEquatable<bool>.
Public int CompareTo(bool
value ).
value. , ; , false, value true; , , , true, value false
|
|
Public int
CompareTo(object obj)
obj. , ; , false, obj true; , , , true, obj false
public bool Equals(bool obj)
true, obj
Public override bool
true,
Equals(object obj)
obj
Public override int
-
GetHashCode()
Public TypeCode
TypeCode
GetTypeCode()
Boolean, .. TypeCode. Boolean
Public static bool
bool
Parse(string s)
s. s Boolean. TrueString, Boolean. FalseString, FormatException, , :
Public override string
,
ToString()
, TrueString, FalseString
Public string
ToString(IFormatProvider
,
provider)
TrueString, FalseString. provider
Public static bool
TryParse(string s, out
s bool.
bool result)
result true. s Boolean. TrueString, Boolean. FalseString, false, , : , Parse (),
Array
Array System. #. , C# . , Array, . 21. 11, . 21. 12.
Array : ICloneable, ICollection, IEnumerable, IStructuralComparable, IStructuralEquatable, IList. , ICloneable, System. Collections, 25.
|
|
I Comparer IComparer<T>. IComparer System. Collections. Compare () , .