日期:2014-05-18 浏览次数:20839 次
char[] c = new char[] { 'a','b','c','d'}; string s = new string(c); Console.WriteLine("{0}",s);
[ComVisible(true)] [Serializable] public sealed class String : IComparable, ICloneable, IConvertible, IComparable<string>, IEnumerable<char>, IEnumerable, IEquatable<string> { public static readonly string Empty = ""; private const int TrimHead = 0; private const int TrimTail = 1; private const int TrimBoth = 2; private const int charPtrAlignConst = 1; private const int alignConst = 3; [NonSerialized] private int m_stringLength; [ForceTokenStabilization] [NonSerialized] private char m_firstChar; internal char FirstChar { get { return this.m_firstChar; } } [IndexerName("Chars")] public char this[int index] { [SecuritySafeCritical, MethodImpl(MethodImplOptions.InternalCall)] get; } public int Length { [SecuritySafeCritical, MethodImpl(MethodImplOptions.InternalCall)] get; } static String() { } [CLSCompliant(false)] [SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] public String(char* value); [SecurityCritical] [CLSCompliant(false)] [MethodImpl(MethodImplOptions.InternalCall)] public String(char* value, int startIndex, int length); [CLSCompliant(false)] [SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] public String(sbyte* value); [CLSCompliant(false)] [SecurityCritical] [MethodImpl(MethodImplOptions.InternalCall)] public String(sbyte* value, int startIndex, int length); [SecurityCritical] [CLSCompliant(false)] [MethodImpl(MethodImplOptions.InternalCall)] public String(sbyte* value, int startIndex, int length, Encoding enc); [SecuritySafeCritical] [MethodImpl(MethodImplOptions.InternalCall)] public String(char[] value, int startIndex, int length); [SecuritySafeCritical] [MethodImpl(MethodImplOptions.InternalCall)] public String(char[] value); [SecuritySafeCritical] [MethodImpl(MethodImplOptions.InternalCall)] public String(char c, int count);
------解决方案--------------------
话说还有一种方式可以清晰的知道,.net你只能靠反编译,但是你可以去看.net的linux实现:mono的源代码,应该是类似的