C#中的string类内部源代码是哪?
C#中的string类源代码是哪?
在哪个文件夹下面?
我想看下这个类是怎么实现的。
------解决方案--------------------装一个Reflector工具看
[Serializable, ComVisible(true)]
public sealed class String : IComparable, ICloneable, IConvertible, IComparable <string> , IEnumerable <char> , IEnumerable, IEquatable <string>
{
// Fields
private const int alignConst = 3;
private const int charPtrAlignConst = 1;
public static readonly string Empty;
[NonSerialized]
private int m_arrayLength;
[NonSerialized]
private char m_firstChar;
[NonSerialized]
private int m_stringLength;
private const int TrimBoth = 2;
private const int TrimHead = 0;
private const int TrimTail = 1;
internal static readonly char[] WhitespaceChars;
// Methods
static String();
[MethodImpl(MethodImplOptions.InternalCall), CLSCompliant(false)]
public extern unsafe String(char* value);
[MethodImpl(MethodImplOptions.InternalCall), CLSCompliant(false)]
public extern unsafe String(sbyte* value);
[MethodImpl(MethodImplOptions.InternalCall)]
public extern String(char[] value);
[MethodImpl(MethodImplOptions.InternalCall)]
public extern String(char c, int count);
[MethodImpl(MethodImplOptions.InternalCall), CLSCompliant(false)]
public extern unsafe String(char* value, int startIndex, int length);
[MethodImpl(MethodImplOptions.InternalCall), CLSCompliant(false)]
public extern unsafe String(sbyte* value, int startIndex, int length);
[MethodImpl(MethodImplOptions.InternalCall)]
public extern String(char[] value, int startIndex, int length);
[MethodImpl(MethodImplOptions.InternalCall), CLSCompliant(false)]
public extern unsafe String(sbyte* value, int startIndex, int length, Encoding enc);
internal void AppendInPlace(char value, int currentLength);
internal void AppendInPlace(string value, int currentLength);
internal void AppendInPlace(char value, int repeatCount, int currentLength);
internal unsafe void AppendInPlace(char* value, int count, int currentLength);
internal void AppendInPlace(string value, int startIndex, int count, int currentLength);
internal void AppendInPlace(char[] value, int start, int count, int currentLength);
internal void ClearPostNullChar();
public object Clone();
public static int Compare(string strA, string strB);
public static int Compare(string strA, string strB, bool ignoreCase);
public static int Compare(string strA, string strB, StringComparison comparisonType);
public static int Compare(string strA, string strB, bool ignoreCase, CultureInfo culture);
public static int Compare(string strA, int indexA, string strB, int indexB, int length);
public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase);
public static int Compare(string strA, int indexA, string strB, int indexB, int length, StringComparison comparisonType);
public static int Compare(string strA, int indexA, string strB, int indexB, int length, bool ignoreCase, CultureInfo culture);
public static int CompareOrdinal(string strA, string strB);
public static int CompareOrdinal(string strA, int indexA, string strB, int indexB, int length);
private static int CompareOrdinalHelper(string strA, string strB);
public int CompareTo(object value);
public int CompareTo(string strB);
public static string Concat(params object[] args);
public static string Concat(object arg0);