using System.Runtime.InteropServices;
using System.Globalization;
namespace System
{
[StructLayout(LayoutKind.Sequential,CharSet=CharSet.Ansi),Serializable,ComVisible(true)]
public struct Char:System.IComparable,System.IConvertible,System.IComparable<char>,System.IEquatable<char>
{
public const char MaxValue = (char)(0xFFFF);
public const char MinValue = (char)(0x0000);
internal const int UNICODE_PLANE00_END = (int)(0x0000FFFF);
internal const int UNICODE_PLANE01_START = (int)(0x00010000);
internal const int UNICODE_PLANE16_END = (int)(0x0010FFFF);
internal const int HIGH_SURROGATE_START = (int)(0x0000D800);
internal const int LOW_SURROGATE_END = (int)(0x0000DFFF);
internal char m_value;
private static readonly byte[] categoryForLatin1;
private static bool IsLatin1(char ch)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4 0xff
//IL_0006: cgt
//IL_0008: ldc.i4.0
//IL_0009: ceq
//IL_000b: ret
return (ch > '\xff') == false;
}
private static bool IsAscii(char ch)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4.s 127
//IL_0003: cgt
//IL_0005: ldc.i4.0
//IL_0006: ceq
//IL_0008: ret
return (ch > '\x7f') == false;
}
private static System.Globalization.UnicodeCategory GetLatin1UnicodeCategory(char ch)
{
//.maxstack 8
//IL_0000: ldsfld uint8[] System.Char::categoryForLatin1
//IL_0005: ldarg.0
//IL_0006: ldelem.u1
//IL_0007: ret
return System.Char.categoryForLatin1[ch];
}
public override int GetHashCode()
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ldarg.0
//IL_0003: ldind.u2
//IL_0004: ldc.i4.s 16
//IL_0006: shl
//IL_0007: or
//IL_0008: ret
return this;
}
public override bool Equals(object obj)
{
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: isinst System.Char
//IL_0006: brtrue.s IL_000a
//IL_0008: ldc.i4.0
//IL_0009: ret
//IL_000a: ldarg.0
//IL_000b: ldind.u2
//IL_000c: ldarg.1
//IL_000d: unbox.any System.Char
//IL_0012: ceq
//IL_0014: ret
if(obj is System.Char)
{
return this==(char)obj;
}
else
{
return false;
}
}
public new virtual sealed bool Equals(char obj)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ldarg.1
//IL_0003: ceq
//IL_0005: ret
return this==obj;
}
public new virtual sealed int CompareTo(object @value)
{
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: brtrue.s IL_0005
//IL_0003: ldc.i4.1
//IL_0004: ret
//IL_0005: ldarg.1
//IL_0006: isinst System.Char
//IL_000b: brtrue.s IL_001d
//IL_000d: ldstr "Arg_MustBeChar"
//IL_0012: call string System.Environment::GetResourceString(string)
//IL_0017: newobj instance void System.ArgumentException::.ctor(string)
//IL_001c: throw
//IL_001d: ldarg.0
//IL_001e: ldind.u2
//IL_001f: ldarg.1
//IL_0020: unbox.any System.Char
//IL_0025: sub
//IL_0026: ret
if(@value==null)
{
return 1;
}
else
{
if(@value is System.Char)
{
return this-(char)@value;
}
else
{
throw new System.ArgumentException(System.Environment.GetResourceString("Arg_MustBeChar"));
}
}
}
public new virtual sealed int CompareTo(char @value)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ldarg.1
//IL_0003: sub
//IL_0004: ret
return this-@value;
}
public override string ToString()
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call string System.Char::ToString(char)
//IL_0007: ret
return char.ToString(this);
}
public new virtual sealed string ToString( System.IFormatProvider provider)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call string System.Char::ToString(char)
//IL_0007: ret
return char.ToString(this);
}
public static string ToString(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4.1
//IL_0002: newobj instance void System.String::.ctor(char,
//int32)
//IL_0007: ret
return new System.String(c,1);
}
public static char Parse(string s)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.0
//IL_000f: callvirt instance int32 System.String::get_Length()
//IL_0014: ldc.i4.1
//IL_0015: beq.s IL_0027
//IL_0017: ldstr "Format_NeedSingleChar"
//IL_001c: call string System.Environment::GetResourceString(string)
//IL_0021: newobj instance void System.FormatException::.ctor(string)
//IL_0026: throw
//IL_0027: ldarg.0
//IL_0028: ldc.i4.0
//IL_0029: callvirt instance char System.String::get_Chars(int32)
//IL_002e: ret
if(s!=null&&s.Length==1)
{
return s[0];
}
else
{
throw new System.ArgumentNullException("s");
}
}
public static bool TryParse(string s, out char result)
{
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: ldc.i4.0
//IL_0002: stind.i2
//IL_0003: ldarg.0
//IL_0004: brtrue.s IL_0008
//IL_0006: ldc.i4.0
//IL_0007: ret
//IL_0008: ldarg.0
//IL_0009: callvirt instance int32 System.String::get_Length()
//IL_000e: ldc.i4.1
//IL_000f: beq.s IL_0013
//IL_0011: ldc.i4.0
//IL_0012: ret
//IL_0013: ldarg.1
//IL_0014: ldarg.0
//IL_0015: ldc.i4.0
//IL_0016: callvirt instance char System.String::get_Chars(int32)
//IL_001b: stind.i2
//IL_001c: ldc.i4.1
//IL_001d: ret
result='\0';
if(s!=null&&s.Length==1)
{
result=s[0];
return true;
}
else
{
return false;
}
}
public static bool IsDigit(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_0018
//IL_0008: ldarg.0
//IL_0009: ldc.i4.s 48
//IL_000b: blt.s IL_0016
//IL_000d: ldarg.0
//IL_000e: ldc.i4.s 57
//IL_0010: cgt
//IL_0012: ldc.i4.0
//IL_0013: ceq
//IL_0015: ret
//IL_0016: ldc.i4.0
//IL_0017: ret
//IL_0018: ldarg.0
//IL_0019: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(char)
//IL_001e: ldc.i4.8
//IL_001f: ceq
//IL_0021: ret
if(System.Char.IsLatin1(c))
{
if(c>='0'&&c<='9')
{
return true;
}
else
{
return false;
}
}
else
{
return CharUnicodeInfo.GetUnicodeCategory(c)==UnicodeCategory.DecimalDigitNumber;
}
}
internal static bool CheckLetter( System.Globalization.UnicodeCategory uc)
{
//.maxstack 1
//.locals init (valuetype System.Globalization.UnicodeCategory V_0)
//IL_0000: ldarg.0
//IL_0001: stloc.0
//IL_0002: ldloc.0
//IL_0003: switch (
//IL_001e,
//IL_001e,
//IL_001e,
//IL_001e,
//IL_001e)
//IL_001c: br.s IL_0020
//IL_001e: ldc.i4.1
//IL_001f: ret
//IL_0020: ldc.i4.0
//IL_0021: ret
UnicodeCategory V_0;
V_0=uc;
switch(V_0)
{
case UnicodeCategory.UppercaseLetter:
case UnicodeCategory.LowercaseLetter:
case UnicodeCategory.TitlecaseLetter:
case UnicodeCategory.ModifierLetter:
case UnicodeCategory.OtherLetter:
{
return true;
}
default:
return false;
}
}
public static bool IsLetter(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_0033
//IL_0008: ldarg.0
//IL_0009: call bool System.Char::IsAscii(char)
//IL_000e: brfalse.s IL_0027
//IL_0010: ldarg.0
//IL_0011: ldc.i4.s 32
//IL_0013: or
//IL_0014: conv.u2
//IL_0015: starg.s c
//IL_0017: ldarg.0
//IL_0018: ldc.i4.s 97
//IL_001a: blt.s IL_0025
//IL_001c: ldarg.0
//IL_001d: ldc.i4.s 122
//IL_001f: cgt
//IL_0021: ldc.i4.0
//IL_0022: ceq
//IL_0024: ret
//IL_0025: ldc.i4.0
//IL_0026: ret
//IL_0027: ldarg.0
//IL_0028: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_002d: call bool System.Char::CheckLetter(valuetype System.Globalization.UnicodeCategory)
//IL_0032: ret
//IL_0033: ldarg.0
//IL_0034: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(char)
//IL_0039: call bool System.Char::CheckLetter(valuetype System.Globalization.UnicodeCategory)
//IL_003e: ret
/*
* A-Z:65-90:0x41-0x5a
* a-z:97-122:0x61-0x7a
*
*/
if(System.Char.IsLatin1(c))
{
if(System.Char.IsAscii(c))
{
c=(char)(c|32);
if(c>=97&&c<=122)
{
return true;
}
else
{
return false;
}
}
else
{
return char.CheckLetter(System.Char.GetLatin1UnicodeCategory(c));
}
}
else
{
return char.CheckLetter(CharUnicodeInfo.GetUnicodeCategory(c));
}
}
private static bool IsWhiteSpaceLatin1(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4.s 32
//IL_0003: beq.s IL_001f
//IL_0005: ldarg.0
//IL_0006: ldc.i4.s 9
//IL_0008: blt.s IL_000f
//IL_000a: ldarg.0
//IL_000b: ldc.i4.s 13
//IL_000d: ble.s IL_001f
//IL_000f: ldarg.0
//IL_0010: ldc.i4 0xa0
//IL_0015: beq.s IL_001f
//IL_0017: ldarg.0
//IL_0018: ldc.i4 0x85
//IL_001d: bne.un.s IL_0021
//IL_001f: ldc.i4.1
//IL_0020: ret
//IL_0021: ldc.i4.0
//IL_0022: ret
/* \t:0x9
* \n:0xA
* \v:0xB
* \f:0xC
* \r:0xD
* \s:0x20
* \ :0xA0(No-Break Space)
* \ :0x85(next line)
*/
if(c=='\x20'||c=='\xA0'||c=='\x85')
{
return true;
}
else if(c>='\t'&&c<='\r')
{
return true;
}
else
{
return false;
}
}
public static bool IsWhiteSpace(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_000f
//IL_0008: ldarg.0
//IL_0009: call bool System.Char::IsWhiteSpaceLatin1(char)
//IL_000e: ret
//IL_000f: ldarg.0
//IL_0010: call bool System.Globalization.CharUnicodeInfo::IsWhiteSpace(char)
//IL_0015: ret
if(System.Char.IsLatin1(c))
{
return System.Char.IsWhiteSpaceLatin1(c);
}
else
{
return CharUnicodeInfo.IsWhiteSpace(c);
}
}
public static bool IsUpper(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_002a
//IL_0008: ldarg.0
//IL_0009: call bool System.Char::IsAscii(char)
//IL_000e: brfalse.s IL_0020
//IL_0010: ldarg.0
//IL_0011: ldc.i4.s 65
//IL_0013: blt.s IL_001e
//IL_0015: ldarg.0
//IL_0016: ldc.i4.s 90
//IL_0018: cgt
//IL_001a: ldc.i4.0
//IL_001b: ceq
//IL_001d: ret
//IL_001e: ldc.i4.0
//IL_001f: ret
//IL_0020: ldarg.0
//IL_0021: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_0026: ldc.i4.0
//IL_0027: ceq
//IL_0029: ret
//IL_002a: ldarg.0
//IL_002b: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(char)
//IL_0030: ldc.i4.0
//IL_0031: ceq
//IL_0033: ret
if(System.Char.IsLatin1(c))
{
if(System.Char.IsAscii(c))
{
if(c>='A'&&c<='Z')
{
return true;
}
else
{
return false;
}
}
else
{
return System.Char.GetLatin1UnicodeCategory(c)==UnicodeCategory.UppercaseLetter;
}
}
else
{
return CharUnicodeInfo.GetUnicodeCategory(c)==UnicodeCategory.UppercaseLetter;
}
}
public static bool IsLower(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_002a
//IL_0008: ldarg.0
//IL_0009: call bool System.Char::IsAscii(char)
//IL_000e: brfalse.s IL_0020
//IL_0010: ldarg.0
//IL_0011: ldc.i4.s 97
//IL_0013: blt.s IL_001e
//IL_0015: ldarg.0
//IL_0016: ldc.i4.s 122
//IL_0018: cgt
//IL_001a: ldc.i4.0
//IL_001b: ceq
//IL_001d: ret
//IL_001e: ldc.i4.0
//IL_001f: ret
//IL_0020: ldarg.0
//IL_0021: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_0026: ldc.i4.1
//IL_0027: ceq
//IL_0029: ret
//IL_002a: ldarg.0
//IL_002b: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(char)
//IL_0030: ldc.i4.1
//IL_0031: ceq
//IL_0033: ret
if(System.Char.IsLatin1(c))
{
if(System.Char.IsAscii(c))
{
if(c>='a'&&c<='z')
{
return true;
}
else
{
return false;
}
}
else
{
return System.Char.GetLatin1UnicodeCategory(c)==UnicodeCategory.LowercaseLetter;
}
}
else
{
return CharUnicodeInfo.GetUnicodeCategory(c)==UnicodeCategory.LowercaseLetter;
}
}
internal static bool CheckPunctuation( System.Globalization.UnicodeCategory uc)
{
//.maxstack 2
//.locals init (valuetype System.Globalization.UnicodeCategory V_0)
//IL_0000: ldarg.0
//IL_0001: stloc.0
//IL_0002: ldloc.0
//IL_0003: ldc.i4.s 18
//IL_0005: sub
//IL_0006: switch (
//IL_0029,
//IL_0029,
//IL_0029,
//IL_0029,
//IL_0029,
//IL_0029,
//IL_0029)
//IL_0027: br.s IL_002b
//IL_0029: ldc.i4.1
//IL_002a: ret
//IL_002b: ldc.i4.0
//IL_002c: ret
UnicodeCategory V_0;
V_0=uc;
switch(V_0)
{
case UnicodeCategory.ConnectorPunctuation:
case UnicodeCategory.DashPunctuation:
case UnicodeCategory.OpenPunctuation:
case UnicodeCategory.ClosePunctuation:
case UnicodeCategory.InitialQuotePunctuation:
case UnicodeCategory.FinalQuotePunctuation:
case UnicodeCategory.OtherPunctuation:
return true;
default:
return false;
}
}
public static bool IsPunctuation(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_0014
//IL_0008: ldarg.0
//IL_0009: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_000e: call bool System.Char::CheckPunctuation(valuetype System.Globalization.UnicodeCategory)
//IL_0013: ret
//IL_0014: ldarg.0
//IL_0015: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(char)
//IL_001a: call bool System.Char::CheckPunctuation(valuetype System.Globalization.UnicodeCategory)
//IL_001f: ret
if(System.Char.IsLatin1(c))
{
return System.Char.CheckPunctuation(System.Char.GetLatin1UnicodeCategory(c));
}
else
{
return System.Char.CheckPunctuation(CharUnicodeInfo.GetUnicodeCategory(c));
}
}
internal static bool CheckLetterOrDigit( System.Globalization.UnicodeCategory uc)
{
//.maxstack 1
//.locals init (valuetype System.Globalization.UnicodeCategory V_0)
//IL_0000: ldarg.0
//IL_0001: stloc.0
//IL_0002: ldloc.0
//IL_0003: switch (
//IL_002e,
//IL_002e,
//IL_002e,
//IL_002e,
//IL_002e,
//IL_0030,
//IL_0030,
//IL_0030,
//IL_002e)
//IL_002c: br.s IL_0030
//IL_002e: ldc.i4.1
//IL_002f: ret
//IL_0030: ldc.i4.0
//IL_0031: ret
UnicodeCategory V_0;
V_0=uc;
switch(V_0)
{
case UnicodeCategory.UppercaseLetter:
case UnicodeCategory.LowercaseLetter:
case UnicodeCategory.TitlecaseLetter:
case UnicodeCategory.ModifierLetter:
case UnicodeCategory.OtherLetter:
case UnicodeCategory.DecimalDigitNumber:
{
return true;
}
case UnicodeCategory.NonSpacingMark:
case UnicodeCategory.SpacingCombiningMark:
case UnicodeCategory.EnclosingMark:
{
return false;
}
default:
return false;
}
}
public static bool IsLetterOrDigit(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_0014
//IL_0008: ldarg.0
//IL_0009: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_000e: call bool System.Char::CheckLetterOrDigit(valuetype System.Globalization.UnicodeCategory)
//IL_0013: ret
//IL_0014: ldarg.0
//IL_0015: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(char)
//IL_001a: call bool System.Char::CheckLetterOrDigit(valuetype System.Globalization.UnicodeCategory)
//IL_001f: ret
if(System.Char.IsLatin1(c))
{
return System.Char.CheckLetterOrDigit(System.Char.GetLatin1UnicodeCategory(c));
}
else
{
return System.Char.CheckLetterOrDigit(CharUnicodeInfo.GetUnicodeCategory(c));
}
}
public static char ToUpper(char c, System.Globalization.CultureInfo culture)
{
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "culture"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: callvirt instance class System.Globalization.TextInfo System.Globalization.CultureInfo::get_TextInfo()
//IL_0014: ldarg.0
//IL_0015: callvirt instance char System.Globalization.TextInfo::ToUpper(char)
//IL_001a: ret
if(culture==null)
{
throw new System.ArgumentNullException("culture");
}
else
{
return culture.TextInfo.ToUpper(c);
}
}
public static char ToUpper(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_CurrentCulture()
//IL_0006: call char System.Char::ToUpper(char,
//class System.Globalization.CultureInfo)
//IL_000b: ret
return System.Char.ToUpper(c,CultureInfo.CurrentCulture);
}
public static char ToUpperInvariant(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_InvariantCulture()
//IL_0006: call char System.Char::ToUpper(char,
//class System.Globalization.CultureInfo)
//IL_000b: ret
return System.Char.ToUpper(c,CultureInfo.InvariantCulture);
}
public static char ToLower(char c, System.Globalization.CultureInfo culture)
{
//.maxstack 8
//IL_0000: ldarg.1
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "culture"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: callvirt instance class System.Globalization.TextInfo System.Globalization.CultureInfo::get_TextInfo()
//IL_0014: ldarg.0
//IL_0015: callvirt instance char System.Globalization.TextInfo::ToLower(char)
//IL_001a: ret
if(culture==null)
{
throw new System.ArgumentNullException("culture");
}
else
{
return culture.TextInfo.ToLower(c);
}
}
public static char ToLower(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_CurrentCulture()
//IL_0006: call char System.Char::ToLower(char,
//class System.Globalization.CultureInfo)
//IL_000b: ret
return System.Char.ToLower(c,CultureInfo.CurrentCulture);
}
public static char ToLowerInvariant(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_InvariantCulture()
//IL_0006: call char System.Char::ToLower(char,
//class System.Globalization.CultureInfo)
//IL_000b: ret
return System.Char.ToLower(c,CultureInfo.InvariantCulture);
}
public new virtual sealed System.TypeCode GetTypeCode()
{
//.maxstack 8
//IL_0000: ldc.i4.4
//IL_0001: ret
return TypeCode.Char;
}
private new virtual sealed bool System.IConvertible.ToBoolean( System.IFormatProvider provider)
{
//.override System.IConvertible::ToBoolean
//.maxstack 5
//.locals init (object[] V_0)
//IL_0000: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_CurrentCulture()
//IL_0005: ldstr "InvalidCast_FromTo"
//IL_000a: call string System.Environment::GetResourceString(string)
//IL_000f: ldc.i4.2
//IL_0010: newarr System.Object
//IL_0015: stloc.0
//IL_0016: ldloc.0
//IL_0017: ldc.i4.0
//IL_0018: ldstr "Char"
//IL_001d: stelem.ref
//IL_001e: ldloc.0
//IL_001f: ldc.i4.1
//IL_0020: ldstr "Boolean"
//IL_0025: stelem.ref
//IL_0026: ldloc.0
//IL_0027: call string System.String::Format(class System.IFormatProvider,
//string,
//object[])
//IL_002c: newobj instance void System.InvalidCastException::.ctor(string)
//IL_0031: throw
object[] V_0;
V_0=new object[2];V_0[0]="Char";V_0[1]="Boolean";
throw new System.InvalidCastException(string.Format(CultureInfo.CurrentCulture,System.Environment.GetResourceString("InvalidCast_FromTo"),V_0));
}
private new virtual sealed char System.IConvertible.ToChar( System.IFormatProvider provider)
{
//.override System.IConvertible::ToChar
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: ret
return this;
}
private new virtual sealed sbyte System.IConvertible.ToSByte( System.IFormatProvider provider)
{
//.override System.IConvertible::ToSByte
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call int8 System.Convert::ToSByte(char)
//IL_0007: ret
return System.Convert.ToSByte(this);
}
private new virtual sealed byte System.IConvertible.ToByte( System.IFormatProvider provider)
{
//.override System.IConvertible::ToByte
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call uint8 System.Convert::ToByte(char)
//IL_0007: ret
return System.Convert.ToByte(this);
}
private new virtual sealed short System.IConvertible.ToInt16( System.IFormatProvider provider)
{
//.override System.IConvertible::ToInt16
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call int16 System.Convert::ToInt16(char)
//IL_0007: ret
return System.Convert.ToInt16(this);
}
private new virtual sealed ushort System.IConvertible.ToUInt16( System.IFormatProvider provider)
{
//.override System.IConvertible::ToUInt16
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call uint16 System.Convert::ToUInt16(char)
//IL_0007: ret
return System.Convert.ToUInt16(this);
}
private new virtual sealed int System.IConvertible.ToInt32( System.IFormatProvider provider)
{
//.override System.IConvertible::ToInt32
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call int32 System.Convert::ToInt32(char)
//IL_0007: ret
return System.Convert.ToInt32(this);
}
private new virtual sealed uint System.IConvertible.ToUInt32( System.IFormatProvider provider)
{
//.override System.IConvertible::ToUInt32
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call uint32 System.Convert::ToUInt32(char)
//IL_0007: ret
return System.Convert.ToUInt32(this);
}
private new virtual sealed long System.IConvertible.ToInt64( System.IFormatProvider provider)
{
//.override System.IConvertible::ToInt64
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call int64 System.Convert::ToInt64(char)
//IL_0007: ret
return System.Convert.ToInt64(this);
}
private new virtual sealed ulong System.IConvertible.ToUInt64( System.IFormatProvider provider)
{
//.override System.IConvertible::ToUInt64
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: call uint64 System.Convert::ToUInt64(char)
//IL_0007: ret
return System.Convert.ToUInt64(this);
}
private new virtual sealed float System.IConvertible.ToSingle( System.IFormatProvider provider)
{
//.override System.IConvertible::ToSingle
//.maxstack 5
//.locals init (object[] V_0)
//IL_0000: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_CurrentCulture()
//IL_0005: ldstr "InvalidCast_FromTo"
//IL_000a: call string System.Environment::GetResourceString(string)
//IL_000f: ldc.i4.2
//IL_0010: newarr System.Object
//IL_0015: stloc.0
//IL_0016: ldloc.0
//IL_0017: ldc.i4.0
//IL_0018: ldstr "Char"
//IL_001d: stelem.ref
//IL_001e: ldloc.0
//IL_001f: ldc.i4.1
//IL_0020: ldstr "Single"
//IL_0025: stelem.ref
//IL_0026: ldloc.0
//IL_0027: call string System.String::Format(class System.IFormatProvider,
//string,
//object[])
//IL_002c: newobj instance void System.InvalidCastException::.ctor(string)
//IL_0031: throw
object[] V_0;
V_0=new object[2];V_0[0]="Char";V_0[1]="Single";
throw new System.InvalidCastException(string.Format(CultureInfo.CurrentCulture,System.Environment.GetResourceString("InvalidCast_FromTo"),V_0));
}
private new virtual sealed double System.IConvertible.ToDouble( System.IFormatProvider provider)
{
//.override System.IConvertible::ToDouble
//.maxstack 5
//.locals init (object[] V_0)
//IL_0000: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_CurrentCulture()
//IL_0005: ldstr "InvalidCast_FromTo"
//IL_000a: call string System.Environment::GetResourceString(string)
//IL_000f: ldc.i4.2
//IL_0010: newarr System.Object
//IL_0015: stloc.0
//IL_0016: ldloc.0
//IL_0017: ldc.i4.0
//IL_0018: ldstr "Char"
//IL_001d: stelem.ref
//IL_001e: ldloc.0
//IL_001f: ldc.i4.1
//IL_0020: ldstr "Double"
//IL_0025: stelem.ref
//IL_0026: ldloc.0
//IL_0027: call string System.String::Format(class System.IFormatProvider,
//string,
//object[])
//IL_002c: newobj instance void System.InvalidCastException::.ctor(string)
//IL_0031: throw
object[] V_0;
V_0=new object[2];V_0[0]="Char";V_0[1]="Double";
throw new System.InvalidCastException(string.Format(CultureInfo.CurrentCulture,System.Environment.GetResourceString("InvalidCast_FromTo"),V_0));
}
private new virtual sealed System.Decimal System.IConvertible.ToDecimal( System.IFormatProvider provider)
{
//.override System.IConvertible::ToDecimal
//.maxstack 5
//.locals init (object[] V_0)
//IL_0000: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_CurrentCulture()
//IL_0005: ldstr "InvalidCast_FromTo"
//IL_000a: call string System.Environment::GetResourceString(string)
//IL_000f: ldc.i4.2
//IL_0010: newarr System.Object
//IL_0015: stloc.0
//IL_0016: ldloc.0
//IL_0017: ldc.i4.0
//IL_0018: ldstr "Char"
//IL_001d: stelem.ref
//IL_001e: ldloc.0
//IL_001f: ldc.i4.1
//IL_0020: ldstr "Decimal"
//IL_0025: stelem.ref
//IL_0026: ldloc.0
//IL_0027: call string System.String::Format(class System.IFormatProvider,
//string,
//object[])
//IL_002c: newobj instance void System.InvalidCastException::.ctor(string)
//IL_0031: throw
object[] V_0;
V_0=new object[2];V_0[0]="Char";V_0[1]="Decimal";
throw new System.InvalidCastException(string.Format(CultureInfo.CurrentCulture,System.Environment.GetResourceString("InvalidCast_FromTo"),V_0));
}
private new virtual sealed System.DateTime System.IConvertible.ToDateTime( System.IFormatProvider provider)
{
//.override System.IConvertible::ToDateTime
//.maxstack 5
//.locals init (object[] V_0)
//IL_0000: call class System.Globalization.CultureInfo System.Globalization.CultureInfo::get_CurrentCulture()
//IL_0005: ldstr "InvalidCast_FromTo"
//IL_000a: call string System.Environment::GetResourceString(string)
//IL_000f: ldc.i4.2
//IL_0010: newarr System.Object
//IL_0015: stloc.0
//IL_0016: ldloc.0
//IL_0017: ldc.i4.0
//IL_0018: ldstr "Char"
//IL_001d: stelem.ref
//IL_001e: ldloc.0
//IL_001f: ldc.i4.1
//IL_0020: ldstr "DateTime"
//IL_0025: stelem.ref
//IL_0026: ldloc.0
//IL_0027: call string System.String::Format(class System.IFormatProvider,
//string,
//object[])
//IL_002c: newobj instance void System.InvalidCastException::.ctor(string)
//IL_0031: throw
object[] V_0;
V_0=new object[2];V_0[0]="Char";V_0[1]="DateTime";
throw new System.InvalidCastException(string.Format(CultureInfo.CurrentCulture,System.Environment.GetResourceString("InvalidCast_FromTo"),V_0));
}
private new virtual sealed object System.IConvertible.ToType( System.Type @type, System.IFormatProvider provider)
{
//.override System.IConvertible::ToType
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldind.u2
//IL_0002: box System.Char
//IL_0007: ldarg.1
//IL_0008: ldarg.2
//IL_0009: call object System.Convert::DefaultToType(class System.IConvertible,
//class System.Type,
//class System.IFormatProvider)
//IL_000e: ret
return System.Convert.DefaultToType((System.IConvertible)this,@type,provider);
}
public static bool IsControl(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_0013
//IL_0008: ldarg.0
//IL_0009: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_000e: ldc.i4.s 14
//IL_0010: ceq
//IL_0012: ret
//IL_0013: ldarg.0
//IL_0014: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(char)
//IL_0019: ldc.i4.s 14
//IL_001b: ceq
//IL_001d: ret
if(System.Char.IsLatin1(c))
{
return System.Char.GetLatin1UnicodeCategory(c)==System.Globalization.UnicodeCategory.Control;
}
else
{
return CharUnicodeInfo.GetUnicodeCategory(c)==System.Globalization.UnicodeCategory.Control;
}
}
public static bool IsControl(string s, int index)
{
//.maxstack 2
//.locals init (char V_0)
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: stloc.0
//IL_002a: ldloc.0
//IL_002b: call bool System.Char::IsLatin1(char)
//IL_0030: brfalse.s IL_003d
//IL_0032: ldloc.0
//IL_0033: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_0038: ldc.i4.s 14
//IL_003a: ceq
//IL_003c: ret
//IL_003d: ldarg.0
//IL_003e: ldarg.1
//IL_003f: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(string,
//int32)
//IL_0044: ldc.i4.s 14
//IL_0046: ceq
//IL_0048: ret
char V_0;
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
V_0=s[index];
if(System.Char.IsLatin1(V_0))
{
return System.Char.GetLatin1UnicodeCategory(V_0)==System.Globalization.UnicodeCategory.Control;
}
else
{
return CharUnicodeInfo.GetUnicodeCategory(V_0)==System.Globalization.UnicodeCategory.Control;
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsDigit(string s, int index)
{
//.maxstack 2
//.locals init (char V_0)
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: stloc.0
//IL_002a: ldloc.0
//IL_002b: call bool System.Char::IsLatin1(char)
//IL_0030: brfalse.s IL_0042
//IL_0032: ldloc.0
//IL_0033: ldc.i4.s 48
//IL_0035: blt.s IL_0040
//IL_0037: ldloc.0
//IL_0038: ldc.i4.s 57
//IL_003a: cgt
//IL_003c: ldc.i4.0
//IL_003d: ceq
//IL_003f: ret
//IL_0040: ldc.i4.0
//IL_0041: ret
//IL_0042: ldarg.0
//IL_0043: ldarg.1
//IL_0044: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(string,
//int32)
//IL_0049: ldc.i4.8
//IL_004a: ceq
//IL_004c: ret
char V_0;
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
V_0=s[index];
if(System.Char.IsLatin1(V_0))
{
if(V_0>=48&&V_0<=57)
{
return true;
}
else
{
return false;
}
}
else
{
return CharUnicodeInfo.GetUnicodeCategory(s,index)==UnicodeCategory.DecimalDigitNumber;
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsLetter(string s, int index)
{
//.maxstack 2
//.locals init (char V_0)
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: stloc.0
//IL_002a: ldloc.0
//IL_002b: call bool System.Char::IsLatin1(char)
//IL_0030: brfalse.s IL_005c
//IL_0032: ldloc.0
//IL_0033: call bool System.Char::IsAscii(char)
//IL_0038: brfalse.s IL_0050
//IL_003a: ldloc.0
//IL_003b: ldc.i4.s 32
//IL_003d: or
//IL_003e: conv.u2
//IL_003f: stloc.0
//IL_0040: ldloc.0
//IL_0041: ldc.i4.s 97
//IL_0043: blt.s IL_004e
//IL_0045: ldloc.0
//IL_0046: ldc.i4.s 122
//IL_0048: cgt
//IL_004a: ldc.i4.0
//IL_004b: ceq
//IL_004d: ret
//IL_004e: ldc.i4.0
//IL_004f: ret
//IL_0050: ldloc.0
//IL_0051: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_0056: call bool System.Char::CheckLetter(valuetype System.Globalization.UnicodeCategory)
//IL_005b: ret
//IL_005c: ldarg.0
//IL_005d: ldarg.1
//IL_005e: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(string,
//int32)
//IL_0063: call bool System.Char::CheckLetter(valuetype System.Globalization.UnicodeCategory)
//IL_0068: ret
char V_0;
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
V_0=s[index];
if(System.Char.IsLatin1(V_0))
{
if(System.Char.IsAscii(V_0))
{
V_0=V_0|32;
if(V_0>='a'&&V_0<='z')
{
return true;
}
else
{
return false;
}
}
else
{
return System.Char.CheckLetter(System.Char.GetLatin1UnicodeCategory(V_0));
}
}
else
{
return System.Char.CheckLetter(CharUnicodeInfo.GetUnicodeCategory(s,index));
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsLetterOrDigit(string s, int index)
{
//.maxstack 2
//.locals init (char V_0)
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: stloc.0
//IL_002a: ldloc.0
//IL_002b: call bool System.Char::IsLatin1(char)
//IL_0030: brfalse.s IL_003e
//IL_0032: ldloc.0
//IL_0033: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_0038: call bool System.Char::CheckLetterOrDigit(valuetype System.Globalization.UnicodeCategory)
//IL_003d: ret
//IL_003e: ldarg.0
//IL_003f: ldarg.1
//IL_0040: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(string,
//int32)
//IL_0045: call bool System.Char::CheckLetterOrDigit(valuetype System.Globalization.UnicodeCategory)
//IL_004a: ret
char V_0;
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
V_0=s[index];
if(System.Char.IsLatin1(V_0))
{
return System.Char.CheckLetterOrDigit(System.Char.GetLatin1UnicodeCategory(V_0));
}
else
{
return System.Char.CheckLetterOrDigit(CharUnicodeInfo.GetUnicodeCategory(s,index));
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsLower(string s, int index)
{
//.maxstack 2
//.locals init (char V_0)
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: stloc.0
//IL_002a: ldloc.0
//IL_002b: call bool System.Char::IsLatin1(char)
//IL_0030: brfalse.s IL_0054
//IL_0032: ldloc.0
//IL_0033: call bool System.Char::IsAscii(char)
//IL_0038: brfalse.s IL_004a
//IL_003a: ldloc.0
//IL_003b: ldc.i4.s 97
//IL_003d: blt.s IL_0048
//IL_003f: ldloc.0
//IL_0040: ldc.i4.s 122
//IL_0042: cgt
//IL_0044: ldc.i4.0
//IL_0045: ceq
//IL_0047: ret
//IL_0048: ldc.i4.0
//IL_0049: ret
//IL_004a: ldloc.0
//IL_004b: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_0050: ldc.i4.1
//IL_0051: ceq
//IL_0053: ret
//IL_0054: ldarg.0
//IL_0055: ldarg.1
//IL_0056: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(string,
//int32)
//IL_005b: ldc.i4.1
//IL_005c: ceq
//IL_005e: ret
char V_0;
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
V_0=s[index];
if(System.Char.IsLatin1(V_0))
{
if(System.Char.IsAscii(V_0))
{
if(V_0>='a'&&V_0<='z')
{
return true;
}
else
{
return false;
}
}
else
{
return System.Char.GetLatin1UnicodeCategory(V_0)==UnicodeCategory.LowercaseLetter;
}
}
else
{
return CharUnicodeInfo.GetUnicodeCategory(s,index)==UnicodeCategory.LowercaseLetter;
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
internal static bool CheckNumber( System.Globalization.UnicodeCategory uc)
{
//.maxstack 2
//.locals init (valuetype System.Globalization.UnicodeCategory V_0)
//IL_0000: ldarg.0
//IL_0001: stloc.0
//IL_0002: ldloc.0
//IL_0003: ldc.i4.8
//IL_0004: sub
//IL_0005: switch (
//IL_0018,
//IL_0018,
//IL_0018)
//IL_0016: br.s IL_001a
//IL_0018: ldc.i4.1
//IL_0019: ret
//IL_001a: ldc.i4.0
//IL_001b: ret
UnicodeCategory V_0;
V_0=uc;
switch(V_0)
{
case UnicodeCategory.DecimalDigitNumber:
case UnicodeCategory.LetterNumber:
case UnicodeCategory.OtherNumber:
return true;
default:
return false;
}
}
public static bool IsNumber(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_002c
//IL_0008: ldarg.0
//IL_0009: call bool System.Char::IsAscii(char)
//IL_000e: brfalse.s IL_0020
//IL_0010: ldarg.0
//IL_0011: ldc.i4.s 48
//IL_0013: blt.s IL_001e
//IL_0015: ldarg.0
//IL_0016: ldc.i4.s 57
//IL_0018: cgt
//IL_001a: ldc.i4.0
//IL_001b: ceq
//IL_001d: ret
//IL_001e: ldc.i4.0
//IL_001f: ret
//IL_0020: ldarg.0
//IL_0021: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_0026: call bool System.Char::CheckNumber(valuetype System.Globalization.UnicodeCategory)
//IL_002b: ret
//IL_002c: ldarg.0
//IL_002d: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(char)
//IL_0032: call bool System.Char::CheckNumber(valuetype System.Globalization.UnicodeCategory)
//IL_0037: ret
if(System.Char.IsLatin1(c))
{
if(System.Char.IsAscii(c))
{
if(c>='0'&&c<='9')
{
return true;
}
else
{
return false;
}
}
else
{
return System.Char.CheckNumber(System.Char.GetLatin1UnicodeCategory(c));
}
}
else
{
return System.Char.CheckNumber(CharUnicodeInfo.GetUnicodeCategory(c));
}
}
public static bool IsNumber(string s, int index)
{
//.maxstack 2
//.locals init (char V_0)
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: stloc.0
//IL_002a: ldloc.0
//IL_002b: call bool System.Char::IsLatin1(char)
//IL_0030: brfalse.s IL_0056
//IL_0032: ldloc.0
//IL_0033: call bool System.Char::IsAscii(char)
//IL_0038: brfalse.s IL_004a
//IL_003a: ldloc.0
//IL_003b: ldc.i4.s 48
//IL_003d: blt.s IL_0048
//IL_003f: ldloc.0
//IL_0040: ldc.i4.s 57
//IL_0042: cgt
//IL_0044: ldc.i4.0
//IL_0045: ceq
//IL_0047: ret
//IL_0048: ldc.i4.0
//IL_0049: ret
//IL_004a: ldloc.0
//IL_004b: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_0050: call bool System.Char::CheckNumber(valuetype System.Globalization.UnicodeCategory)
//IL_0055: ret
//IL_0056: ldarg.0
//IL_0057: ldarg.1
//IL_0058: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(string,
//int32)
//IL_005d: call bool System.Char::CheckNumber(valuetype System.Globalization.UnicodeCategory)
//IL_0062: ret
char V_0;
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
V_0=s[index];
if(System.Char.IsLatin1(V_0))
{
if(System.Char.IsAscii(V_0))
{
if(c>='0'&&c<='9')
{
return true;
}
else
{
return false;
}
}
else
{
return System.Char.CheckNumber(System.Char.GetLatin1UnicodeCategory(c));
}
}
else
{
return System.Char.CheckNumber(CharUnicodeInfo.GetUnicodeCategory(c));
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsPunctuation(string s, int index)
{
//.maxstack 2
//.locals init (char V_0)
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: stloc.0
//IL_002a: ldloc.0
//IL_002b: call bool System.Char::IsLatin1(char)
//IL_0030: brfalse.s IL_003e
//IL_0032: ldloc.0
//IL_0033: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_0038: call bool System.Char::CheckPunctuation(valuetype System.Globalization.UnicodeCategory)
//IL_003d: ret
//IL_003e: ldarg.0
//IL_003f: ldarg.1
//IL_0040: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(string,
//int32)
//IL_0045: call bool System.Char::CheckPunctuation(valuetype System.Globalization.UnicodeCategory)
//IL_004a: ret
char V_0;
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
V_0=s[index];
if(System.Char.IsLatin1(V_0))
{
return System.Char.CheckPunctuation(System.Char.GetLatin1UnicodeCategory(c));
}
else
{
return System.Char.CheckPunctuation(CharUnicodeInfo.GetUnicodeCategory(c));
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
internal static bool CheckSeparator( System.Globalization.UnicodeCategory uc)
{
//.maxstack 2
//.locals init (valuetype System.Globalization.UnicodeCategory V_0)
//IL_0000: ldarg.0
//IL_0001: stloc.0
//IL_0002: ldloc.0
//IL_0003: ldc.i4.s 11
//IL_0005: sub
//IL_0006: switch (
//IL_0019,
//IL_0019,
//IL_0019)
//IL_0017: br.s IL_001b
//IL_0019: ldc.i4.1
//IL_001a: ret
//IL_001b: ldc.i4.0
//IL_001c: ret
UnicodeCategory V_0;
V_0=uc;
switch(V_0)
{
case UnicodeCategory.SpaceSeparator:
case UnicodeCategory.LineSeparator:
case UnicodeCategory.ParagraphSeparator:
return true;
default:
return false;
}
}
private static bool IsSeparatorLatin1(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4.s 32
//IL_0003: beq.s IL_000e
//IL_0005: ldarg.0
//IL_0006: ldc.i4 0xa0
//IL_000b: ceq
//IL_000d: ret
//IL_000e: ldc.i4.1
//IL_000f: ret
if(c=='\x32')
{
return true;
}
else
{
return c=='\xa0';
}
}
public static bool IsSeparator(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_000f
//IL_0008: ldarg.0
//IL_0009: call bool System.Char::IsSeparatorLatin1(char)
//IL_000e: ret
//IL_000f: ldarg.0
//IL_0010: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(char)
//IL_0015: call bool System.Char::CheckSeparator(valuetype System.Globalization.UnicodeCategory)
//IL_001a: ret
if(System.Char.IsLatin1(c))
{
return System.Char.IsSeparatorLatin1(c);
}
else
{
return System.Char.CheckSeparator(CharUnicodeInfo.GetUnicodeCategory(c));
}
}
public static bool IsSeparator(string s, int index)
{
//.maxstack 2
//.locals init (char V_0)
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: stloc.0
//IL_002a: ldloc.0
//IL_002b: call bool System.Char::IsLatin1(char)
//IL_0030: brfalse.s IL_0039
//IL_0032: ldloc.0
//IL_0033: call bool System.Char::IsSeparatorLatin1(char)
//IL_0038: ret
//IL_0039: ldarg.0
//IL_003a: ldarg.1
//IL_003b: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(string,
//int32)
//IL_0040: call bool System.Char::CheckSeparator(valuetype System.Globalization.UnicodeCategory)
//IL_0045: ret
char V_0;
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
V_0=s[index];
if(System.Char.IsLatin1(V_0))
{
return System.Char.IsSeparatorLatin1(V_0);
}
else
{
return System.Char.CheckSeparator(CharUnicodeInfo.GetUnicodeCategory(s,index));
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsSurrogate(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4 0xd800
//IL_0006: blt.s IL_0014
//IL_0008: ldarg.0
//IL_0009: ldc.i4 0xdfff
//IL_000e: cgt
//IL_0010: ldc.i4.0
//IL_0011: ceq
//IL_0013: ret
//IL_0014: ldc.i4.0
//IL_0015: ret
if(c>='\xd800'&&c<='\xdfff')
{
return true;
}
else
{
return false;
}
}
public static bool IsSurrogate(string s, int index)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: call bool System.Char::IsSurrogate(char)
//IL_002e: ret
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
return System.Char.IsSurrogate(s[index]);
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
internal static bool CheckSymbol( System.Globalization.UnicodeCategory uc)
{
//.maxstack 2
//.locals init (valuetype System.Globalization.UnicodeCategory V_0)
//IL_0000: ldarg.0
//IL_0001: stloc.0
//IL_0002: ldloc.0
//IL_0003: ldc.i4.s 25
//IL_0005: sub
//IL_0006: switch (
//IL_001d,
//IL_001d,
//IL_001d,
//IL_001d)
//IL_001b: br.s IL_001f
//IL_001d: ldc.i4.1
//IL_001e: ret
//IL_001f: ldc.i4.0
//IL_0020: ret
UnicodeCategory V_0;
V_0=uc;
switch(V_0)
{
case UnicodeCategory.MathSymbol:
case UnicodeCategory.CurrencySymbol:
case UnicodeCategory.ModifierSymbol:
case UnicodeCategory.OtherSymbol:
return true;
default:
return false;
}
}
public static bool IsSymbol(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_0014
//IL_0008: ldarg.0
//IL_0009: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_000e: call bool System.Char::CheckSymbol(valuetype System.Globalization.UnicodeCategory)
//IL_0013: ret
//IL_0014: ldarg.0
//IL_0015: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(char)
//IL_001a: call bool System.Char::CheckSymbol(valuetype System.Globalization.UnicodeCategory)
//IL_001f: ret
if(System.Char.IsLatin1(c))
{
return System.Char.CheckSymbol(System.Char.GetLatin1UnicodeCategory(c));
}
else
{
return System.Char.CheckSymbol(CharUnicodeInfo.GetUnicodeCategory(c));
}
}
public static bool IsSymbol(string s, int index)
{
//.maxstack 2
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: call bool System.Char::IsLatin1(char)
//IL_002e: brfalse.s IL_0042
//IL_0030: ldarg.0
//IL_0031: ldarg.1
//IL_0032: callvirt instance char System.String::get_Chars(int32)
//IL_0037: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_003c: call bool System.Char::CheckSymbol(valuetype System.Globalization.UnicodeCategory)
//IL_0041: ret
//IL_0042: ldarg.0
//IL_0043: ldarg.1
//IL_0044: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(string,
//int32)
//IL_0049: call bool System.Char::CheckSymbol(valuetype System.Globalization.UnicodeCategory)
//IL_004e: ret
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
if(System.Char.IsLatin1(s[index]))
{
return System.Char.CheckSymbol(System.Char.GetLatin1UnicodeCategory(s[index]));
}
else
{
return System.Char.CheckSymbol(CharUnicodeInfo.GetUnicodeCategory(s,index));
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsUpper(string s, int index)
{
//.maxstack 2
//.locals init (char V_0)
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: stloc.0
//IL_002a: ldloc.0
//IL_002b: call bool System.Char::IsLatin1(char)
//IL_0030: brfalse.s IL_0054
//IL_0032: ldloc.0
//IL_0033: call bool System.Char::IsAscii(char)
//IL_0038: brfalse.s IL_004a
//IL_003a: ldloc.0
//IL_003b: ldc.i4.s 65
//IL_003d: blt.s IL_0048
//IL_003f: ldloc.0
//IL_0040: ldc.i4.s 90
//IL_0042: cgt
//IL_0044: ldc.i4.0
//IL_0045: ceq
//IL_0047: ret
//IL_0048: ldc.i4.0
//IL_0049: ret
//IL_004a: ldloc.0
//IL_004b: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_0050: ldc.i4.0
//IL_0051: ceq
//IL_0053: ret
//IL_0054: ldarg.0
//IL_0055: ldarg.1
//IL_0056: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::GetUnicodeCategory(string,
//int32)
//IL_005b: ldc.i4.0
//IL_005c: ceq
//IL_005e: ret
char V_0;
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
V_0=s[index];
if(System.Char.IsLatin1(V_0))
{
if(System.Char.IsAscii(V_0))
{
if(V_0>='A'&&V_0<='Z')
{
return true;
}
else
{
return false;
}
}
else
{
return System.Char.GetLatin1UnicodeCategory(V_0)==UnicodeCategory.UppercaseLetter;
}
}
else
{
return CharUnicodeInfo.GetUnicodeCategory(s,index)==UnicodeCategory.UppercaseLetter;
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsWhiteSpace(string s, int index)
{
//.maxstack 2
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: call bool System.Char::IsLatin1(char)
//IL_002e: brfalse.s IL_003d
//IL_0030: ldarg.0
//IL_0031: ldarg.1
//IL_0032: callvirt instance char System.String::get_Chars(int32)
//IL_0037: call bool System.Char::IsWhiteSpaceLatin1(char)
//IL_003c: ret
//IL_003d: ldarg.0
//IL_003e: ldarg.1
//IL_003f: call bool System.Globalization.CharUnicodeInfo::IsWhiteSpace(string,
//int32)
//IL_0044: ret
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
if(System.Char.IsLatin1(s[index]))
{
return System.Char.IsWhiteSpaceLatin1(s[index]);
}
else
{
return CharUnicodeInfo.IsWhiteSpace(s,index);
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static System.Globalization.UnicodeCategory GetUnicodeCategory(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsLatin1(char)
//IL_0006: brfalse.s IL_000f
//IL_0008: ldarg.0
//IL_0009: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_000e: ret
//IL_000f: ldarg.0
//IL_0010: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::InternalGetUnicodeCategory(int32)
//IL_0015: ret
if(System.Char.IsLatin1(c))
{
return System.Char.GetLatin1UnicodeCategory(c);
}
else
{
return CharUnicodeInfo.InternalGetUnicodeCategory(c);
}
}
public static System.Globalization.UnicodeCategory GetUnicodeCategory(string s, int index)
{
//.maxstack 2
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: callvirt instance char System.String::get_Chars(int32)
//IL_0029: call bool System.Char::IsLatin1(char)
//IL_002e: brfalse.s IL_003d
//IL_0030: ldarg.0
//IL_0031: ldarg.1
//IL_0032: callvirt instance char System.String::get_Chars(int32)
//IL_0037: call valuetype System.Globalization.UnicodeCategory System.Char::GetLatin1UnicodeCategory(char)
//IL_003c: ret
//IL_003d: ldarg.0
//IL_003e: ldarg.1
//IL_003f: call valuetype System.Globalization.UnicodeCategory System.Globalization.CharUnicodeInfo::InternalGetUnicodeCategory(string,
//int32)
//IL_0044: ret
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
if(System.Char.IsLatin1(s[index]))
{
return System.Char.IsWhiteSpaceLatin1(s[index]);
}
else
{
return CharUnicodeInfo.IsWhiteSpace(s,index);
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static double GetNumericValue(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: call float64 System.Globalization.CharUnicodeInfo::GetNumericValue(char)
//IL_0006: ret
return CharUnicodeInfo.GetNumericValue(c);
}
public static double GetNumericValue(string s, int index)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldarg.0
//IL_0010: callvirt instance int32 System.String::get_Length()
//IL_0015: blt.un.s IL_0022
//IL_0017: ldstr "index"
//IL_001c: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0021: throw
//IL_0022: ldarg.0
//IL_0023: ldarg.1
//IL_0024: call float64 System.Globalization.CharUnicodeInfo::GetNumericValue(string,
//int32)
//IL_0029: ret
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index<s.Length)
{
return CharUnicodeInfo.GetNumericValue(s,index);
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsHighSurrogate(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4 0xd800
//IL_0006: blt.s IL_0014
//IL_0008: ldarg.0
//IL_0009: ldc.i4 0xdbff
//IL_000e: cgt
//IL_0010: ldc.i4.0
//IL_0011: ceq
//IL_0013: ret
//IL_0014: ldc.i4.0
//IL_0015: ret
if(c>='\xd800'&&c<='\xdbff')
{
return true;
}
else
{
return false;
}
}
public static bool IsHighSurrogate(string s, int index)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldc.i4.0
//IL_0010: blt.s IL_001b
//IL_0012: ldarg.1
//IL_0013: ldarg.0
//IL_0014: callvirt instance int32 System.String::get_Length()
//IL_0019: blt.s IL_0026
//IL_001b: ldstr "index"
//IL_0020: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0025: throw
//IL_0026: ldarg.0
//IL_0027: ldarg.1
//IL_0028: callvirt instance char System.String::get_Chars(int32)
//IL_002d: call bool System.Char::IsHighSurrogate(char)
//IL_0032: ret
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index>=0&&index<s.Length)
{
return System.Char.IsHighSurrogate(s[index]);
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsLowSurrogate(char c)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4 0xdc00
//IL_0006: blt.s IL_0014
//IL_0008: ldarg.0
//IL_0009: ldc.i4 0xdfff
//IL_000e: cgt
//IL_0010: ldc.i4.0
//IL_0011: ceq
//IL_0013: ret
//IL_0014: ldc.i4.0
//IL_0015: ret
if(c>='\xdc00'&&c<='\xdfff')
{
return true;
}
else
{
return false;
}
}
public static bool IsLowSurrogate(string s, int index)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldc.i4.0
//IL_0010: blt.s IL_001b
//IL_0012: ldarg.1
//IL_0013: ldarg.0
//IL_0014: callvirt instance int32 System.String::get_Length()
//IL_0019: blt.s IL_0026
//IL_001b: ldstr "index"
//IL_0020: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0025: throw
//IL_0026: ldarg.0
//IL_0027: ldarg.1
//IL_0028: callvirt instance char System.String::get_Chars(int32)
//IL_002d: call bool System.Char::IsLowSurrogate(char)
//IL_0032: ret
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index>=0&&index<s.Length)
{
return System.Char.IsLowSurrogate(s[index]);
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsSurrogatePair(string s, int index)
{
//.maxstack 4
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldc.i4.0
//IL_0010: blt.s IL_001b
//IL_0012: ldarg.1
//IL_0013: ldarg.0
//IL_0014: callvirt instance int32 System.String::get_Length()
//IL_0019: blt.s IL_0026
//IL_001b: ldstr "index"
//IL_0020: newobj instance void System.ArgumentOutOfRangeException::.ctor(string)
//IL_0025: throw
//IL_0026: ldarg.1
//IL_0027: ldc.i4.1
//IL_0028: add
//IL_0029: ldarg.0
//IL_002a: callvirt instance int32 System.String::get_Length()
//IL_002f: bge.s IL_0047
//IL_0031: ldarg.0
//IL_0032: ldarg.1
//IL_0033: callvirt instance char System.String::get_Chars(int32)
//IL_0038: ldarg.0
//IL_0039: ldarg.1
//IL_003a: ldc.i4.1
//IL_003b: add
//IL_003c: callvirt instance char System.String::get_Chars(int32)
//IL_0041: call bool System.Char::IsSurrogatePair(char,
//char)
//IL_0046: ret
//IL_0047: ldc.i4.0
//IL_0048: ret
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index>=0&&index<s.Length)
{
if((index+1)>=s.Length)
{
return System.Char.IsSurrogatePair(s[index],s[index+1]);
}
else
{
return false;
}
}
else
{
throw new System.ArgumentOutOfRangeException("index");
}
}
}
public static bool IsSurrogatePair(char highSurrogate, char lowSurrogate)
{
//.maxstack 8
//IL_0000: ldarg.0
//IL_0001: ldc.i4 0xd800
//IL_0006: blt.s IL_0026
//IL_0008: ldarg.0
//IL_0009: ldc.i4 0xdbff
//IL_000e: bgt.s IL_0026
//IL_0010: ldarg.1
//IL_0011: ldc.i4 0xdc00
//IL_0016: blt.s IL_0024
//IL_0018: ldarg.1
//IL_0019: ldc.i4 0xdfff
//IL_001e: cgt
//IL_0020: ldc.i4.0
//IL_0021: ceq
//IL_0023: ret
//IL_0024: ldc.i4.0
//IL_0025: ret
//IL_0026: ldc.i4.0
//IL_0027: ret
if(highSurrogate>='\xd800'&&highSurrogate<='\xdbff'&& lowSurrogate>='\xdc00'&&lowSurrogate<='\xdfff')
{
return true;
}
else
{
return false;
}
}
public static string ConvertFromUtf32(int utf32)
{
//.maxstack 4
//.locals init (char[] V_0)
//IL_0000: ldarg.0
//IL_0001: ldc.i4.0
//IL_0002: blt.s IL_001c
//IL_0004: ldarg.0
//IL_0005: ldc.i4 0x10ffff
//IL_000a: bgt.s IL_001c
//IL_000c: ldarg.0
//IL_000d: ldc.i4 0xd800
//IL_0012: blt.s IL_0031
//IL_0014: ldarg.0
//IL_0015: ldc.i4 0xdfff
//IL_001a: bgt.s IL_0031
//IL_001c: ldstr "utf32"
//IL_0021: ldstr "ArgumentOutOfRange_InvalidUTF32"
//IL_0026: call string System.Environment::GetResourceString(string)
//IL_002b: newobj instance void System.ArgumentOutOfRangeException::.ctor(string,
//string)
//IL_0030: throw
//IL_0031: ldarg.0
//IL_0032: ldc.i4 0x10000
//IL_0037: bge.s IL_0041
//IL_0039: ldarg.0
//IL_003a: conv.u2
//IL_003b: call string System.Char::ToString(char)
//IL_0040: ret
//IL_0041: ldarg.0
//IL_0042: ldc.i4 0x10000
//IL_0047: sub
//IL_0048: starg.s utf32
//IL_004a: ldc.i4.2
//IL_004b: newarr System.Char
//IL_0050: stloc.0
//IL_0051: ldloc.0
//IL_0052: ldc.i4.0
//IL_0053: ldarg.0
//IL_0054: ldc.i4 0x400
//IL_0059: div
//IL_005a: ldc.i4 0xd800
//IL_005f: add
//IL_0060: conv.u2
//IL_0061: stelem.i2
//IL_0062: ldloc.0
//IL_0063: ldc.i4.1
//IL_0064: ldarg.0
//IL_0065: ldc.i4 0x400
//IL_006a: rem
//IL_006b: ldc.i4 0xdc00
//IL_0070: add
//IL_0071: conv.u2
//IL_0072: stelem.i2
//IL_0073: ldloc.0
//IL_0074: newobj instance void System.String::.ctor(char[])
//IL_0079: ret
char[] V_0;
if(utf32>=0&&utf32<=0x10ffff)
{
if(utf32<0xd800||utf32>0xdfff)
{
//IL_0031
if(utf32>=0x10000)
{
//IL_0041
utf32=utf32-0x10000;
V_0=new char[2];
V_0[0]=(char)(utf32/0x400+0xd800);
V_0[1]=(char)(utf32/0x400+0xdc00);
return new string(V_0);
}
else
{
System.Char.ToString((char)utf32);
}
}
else
{
throw new System.ArgumentOutOfRangeException(System.Environment.GetResourceString("utf32"),"ArgumentOutOfRange_InvalidUTF32");
}
}
else
{
throw new System.ArgumentOutOfRangeException(System.Environment.GetResourceString("utf32"),"ArgumentOutOfRange_InvalidUTF32");
}
}
public static int ConvertToUtf32(char highSurrogate, char lowSurrogate)
{
//.maxstack 3
//IL_0000: ldarg.0
//IL_0001: call bool System.Char::IsHighSurrogate(char)
//IL_0006: brtrue.s IL_001d
//IL_0008: ldstr "highSurrogate"
//IL_000d: ldstr "ArgumentOutOfRange_InvalidHighSurrogate"
//IL_0012: call string System.Environment::GetResourceString(string)
//IL_0017: newobj instance void System.ArgumentOutOfRangeException::.ctor(string,
//string)
//IL_001c: throw
//IL_001d: ldarg.1
//IL_001e: call bool System.Char::IsLowSurrogate(char)
//IL_0023: brtrue.s IL_003a
//IL_0025: ldstr "lowSurrogate"
//IL_002a: ldstr "ArgumentOutOfRange_InvalidLowSurrogate"
//IL_002f: call string System.Environment::GetResourceString(string)
//IL_0034: newobj instance void System.ArgumentOutOfRangeException::.ctor(string,
//string)
//IL_0039: throw
//IL_003a: ldarg.0
//IL_003b: ldc.i4 0xd800
//IL_0040: sub
//IL_0041: ldc.i4 0x400
//IL_0046: mul
//IL_0047: ldarg.1
//IL_0048: ldc.i4 0xdc00
//IL_004d: sub
//IL_004e: add
//IL_004f: ldc.i4 0x10000
//IL_0054: add
//IL_0055: ret
if(System.Char.IsHighSurrogate(highSurrogate))
{
//IL_001d
if(System.Char.IsLowSurrogate(lowSurrogate))
{
//IL_003a
return (highSurrogate-0xd800)*0x400+(lowSurrogate-0xdc00)+0x10000;
}
else
{
throw new System.ArgumentOutOfRangeException("lowSurrogate",System.Environment.GetResourceString("ArgumentOutOfRange_InvalidLowSurrogate"));
}
}
else
{
throw new System.ArgumentOutOfRangeException("highSurrogate",System.Environment.GetResourceString("ArgumentOutOfRange_InvalidHighSurrogate"));
}
}
public static int ConvertToUtf32(string s, int index)
{
//.maxstack 4
//.locals init (int32 V_0,
//int32 V_1,
//object[] V_2,
//object[] V_3,
//object[] V_4)
//IL_0000: ldarg.0
//IL_0001: brtrue.s IL_000e
//IL_0003: ldstr "s"
//IL_0008: newobj instance void System.ArgumentNullException::.ctor(string)
//IL_000d: throw
//IL_000e: ldarg.1
//IL_000f: ldc.i4.0
//IL_0010: blt.s IL_001b
//IL_0012: ldarg.1
//IL_0013: ldarg.0
//IL_0014: callvirt instance int32 System.String::get_Length()
//IL_0019: blt.s IL_0030
//IL_001b: ldstr "index"
//IL_0020: ldstr "ArgumentOutOfRange_Index"
//IL_0025: call string System.Environment::GetResourceString(string)
//IL_002a: newobj instance void System.ArgumentOutOfRangeException::.ctor(string,
//string)
//IL_002f: throw
//IL_0030: ldarg.0
//IL_0031: ldarg.1
//IL_0032: callvirt instance char System.String::get_Chars(int32)
//IL_0037: ldc.i4 0xd800
//IL_003c: sub
//IL_003d: stloc.0
//IL_003e: ldloc.0
//IL_003f: ldc.i4.0
//IL_0040: blt IL_0107
//IL_0045: ldloc.0
//IL_0046: ldc.i4 0x7ff
//IL_004b: bgt IL_0107
//IL_0050: ldloc.0
//IL_0051: ldc.i4 0x3ff
//IL_0056: bgt IL_00de
//IL_005b: ldarg.1
//IL_005c: ldarg.0
//IL_005d: callvirt instance int32 System.String::get_Length()
//IL_0062: ldc.i4.1
//IL_0063: sub
//IL_0064: bge.s IL_00b8
//IL_0066: ldarg.0
//IL_0067: ldarg.1
//IL_0068: ldc.i4.1
//IL_0069: add
//IL_006a: callvirt instance char System.String::get_Chars(int32)
//IL_006f: ldc.i4 0xdc00
//IL_0074: sub
//IL_0075: stloc.1
//IL_0076: ldloc.1
//IL_0077: ldc.i4.0
//IL_0078: blt.s IL_0092
//IL_007a: ldloc.1
//IL_007b: ldc.i4 0x3ff
//IL_0080: bgt.s IL_0092
//IL_0082: ldloc.0
//IL_0083: ldc.i4 0x400
//IL_0088: mul
//IL_0089: ldloc.1
//IL_008a: add
//IL_008b: ldc.i4 0x10000
//IL_0090: add
//IL_0091: ret
//IL_0092: ldstr "Argument_InvalidHighSurrogate"
//IL_0097: ldc.i4.1
//IL_0098: newarr System.Object
//IL_009d: stloc.2
//IL_009e: ldloc.2
//IL_009f: ldc.i4.0
//IL_00a0: ldarg.1
//IL_00a1: box System.Int32
//IL_00a6: stelem.ref
//IL_00a7: ldloc.2
//IL_00a8: call string System.Environment::GetResourceString(string,
//object[])
//IL_00ad: ldstr "s"
//IL_00b2: newobj instance void System.ArgumentException::.ctor(string,
//string)
//IL_00b7: throw
//IL_00b8: ldstr "Argument_InvalidHighSurrogate"
//IL_00bd: ldc.i4.1
//IL_00be: newarr System.Object
//IL_00c3: stloc.3
//IL_00c4: ldloc.3
//IL_00c5: ldc.i4.0
//IL_00c6: ldarg.1
//IL_00c7: box System.Int32
//IL_00cc: stelem.ref
//IL_00cd: ldloc.3
//IL_00ce: call string System.Environment::GetResourceString(string,
//object[])
//IL_00d3: ldstr "s"
//IL_00d8: newobj instance void System.ArgumentException::.ctor(string,
//string)
//IL_00dd: throw
//IL_00de: ldstr "Argument_InvalidLowSurrogate"
//IL_00e3: ldc.i4.1
//IL_00e4: newarr System.Object
//IL_00e9: stloc.s V_4
//IL_00eb: ldloc.s V_4
//IL_00ed: ldc.i4.0
//IL_00ee: ldarg.1
//IL_00ef: box System.Int32
//IL_00f4: stelem.ref
//IL_00f5: ldloc.s V_4
//IL_00f7: call string System.Environment::GetResourceString(string,
//object[])
//IL_00fc: ldstr "s"
//IL_0101: newobj instance void System.ArgumentException::.ctor(string,
//string)
//IL_0106: throw
//IL_0107: ldarg.0
//IL_0108: ldarg.1
//IL_0109: callvirt instance char System.String::get_Chars(int32)
//IL_010e: ret
int V_0,V_1;
object[] V_2,V_3,V_4;
if(s==null)
{
throw new System.ArgumentNullException("s");
}
else
{
if(index>=0&&index<s.Length)
{
//IL_0030
V_0=s[index]-0xd800;
if(V_0>=0&&V_0<=0x7ff)
{
if(V_0>0x3ff)
{
//IL_00de
V_4=new object[1];
V_4[0]=index;
throw new System.ArgumentException(System.Environment.GetResourceString("Argument_InvalidLowSurrogate",V_4),"s");
}
else
{
if(index>=(s.Length-1))
{
//IL_00b8
V_3=new object[1];
V_3[0]=index;
throw new System.ArgumentException(System.Environment.GetResourceString("Argument_InvalidHighSurrogate",V_3),"s");
}
else
{
//IL_0066
V_1=s[index+1]-0xdc00;
if(V_1>=0&&V_1<=0x3ff)
{
return (V_0*0x400+V_1+0x10000);
}
else
{
//IL_0092
V_2=new object[1];
V_2[0]=index;
throw new System.ArgumentException(System.Environment.GetResourceString("Argument_InvalidHighSurrogate",V_2),"s");
}
}
}
}
else
{
//IL_0107
return s[index];
}
}
else
{
throw new System.ArgumentOutOfRangeException("index",System.Environment.GetResourceString("ArgumentOutOfRange_Index"));
}
}
}
private static Char()
{
//.maxstack 8
//IL_0000: ldc.i4 0x100
//IL_0005: newarr System.Byte
//IL_000a: dup
//IL_000b: ldtoken field valuetype '<PrivateImplementationDetails>{194744EF-35AC-4CE8-91CB-4E0E512409CC}'/'__StaticArrayInitTypeSize=256' '<PrivateImplementationDetails>{194744EF-35AC-4CE8-91CB-4E0E512409CC}'::'$$method0x600530a-1'
//IL_0010: call void System.Runtime.CompilerServices.RuntimeHelpers::InitializeArray(class System.Array,
//valuetype System.RuntimeFieldHandle)
//IL_0015: stsfld uint8[] System.Char::categoryForLatin1
//IL_001a: ret
System.Char.categoryForLatin1=new byte[256];
System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray(System.Char.categoryForLatin1,'<PrivateImplementationDetails>{194744EF-35AC-4CE8-91CB-4E0E512409CC}'.'$$method0x600530a-1');
}
}
}