string-length
// Gets the length of this string // // This is an intrinsic function so that the JIT can recognise it specially // and eliminate checks on character fetches in a loop like: // for(int i = 0; i < str.Length; i++) str[i] // The actual code generated for this will be one instruction and will be inlined. // public int Length { [Intrinsic] get => _stringLength; }
// // These fields map directly onto the fields in an EE StringObject. See object.h for the layout. // [NonSerialized] private readonly int _stringLength;
//获取此字符串的长度
//这是一个固有的函数,因此JIT可以专门识别它
//并消除循环中对字符获取的检查,如:
//对于(int i=0;i //为此生成的实际代码将是一条指令,并将内联。 这些字段直接映射到EE StringObject中的字段。有关布局,请参见object.h。