79 writes to _firstChar
System.Private.CoreLib (79)
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (11)
77if (Unsafe.Add(ref strA._firstChar, 1) != Unsafe.Add(ref strB._firstChar, 1)) goto DiffOffset1; 87ref Unsafe.Add(ref strA._firstChar, 2), strA.Length - 2, 88ref Unsafe.Add(ref strB._firstChar, 2), strB.Length - 2); 99return Unsafe.Add(ref strA._firstChar, 1) - Unsafe.Add(ref strB._firstChar, 1); 498return Unsafe.Add(ref _firstChar, (nint)localLength - 1) == value; 696return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref _firstChar), (uint)_stringLength * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32)); 707return Marvin.ComputeHash32OrdinalIgnoreCase(ref _firstChar, _stringLength /* in chars, not bytes */, (uint)seed, (uint)(seed >> 32)); 770fixed (char* src = &_firstChar) 867fixed (char* src = &_firstChar)
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.cs (23)
86destination: ref result._firstChar, 113destination: ref result._firstChar, 139destination: ref result._firstChar, 173destination: ref result._firstChar, 303SpanHelpers.Fill(ref result._firstChar, (uint)count, c); 321Buffer.Memmove(ref result._firstChar, ref MemoryMarshal.GetReference(value), (uint)value.Length); 390slice = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, (nint)(uint)startIndex /* force zero-extension */), count); 409destination: ref result._firstChar, 410source: ref str._firstChar); 432source: ref Unsafe.Add(ref _firstChar, sourceIndex), 444Buffer.Memmove(ref destination._reference, ref _firstChar, (uint)Length); 461Buffer.Memmove(ref destination._reference, ref _firstChar, (uint)Length); 477source: ref _firstChar, 501source: ref Unsafe.Add(ref _firstChar, startIndex), 529public ref readonly char GetPinnableReference() => ref _firstChar; 531internal ref char GetRawStringData() => ref _firstChar; 532internal ref byte GetRawStringDataAsUInt8() => ref Unsafe.As<char, byte>(ref _firstChar); 533internal ref ushort GetRawStringDataAsUInt16() => ref Unsafe.As<char, ushort>(ref _firstChar); 553fixed (char* pTempChars = &s._firstChar) 569result._firstChar = c; 576result._firstChar = c1; 577Unsafe.Add(ref result._firstChar, 1) = c2; 739return Unsafe.Add(ref _firstChar, (nint)(uint)index /* force zero-extension */);
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (32)
74destination: ref Unsafe.Add(ref dest._firstChar, destPos), 75source: ref src._firstChar, 317Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 334Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 356Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 381Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 731Buffer.Memmove(ref result._firstChar, ref _firstChar, (nuint)startIndex); 732Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex), ref value._firstChar, (nuint)insertLength); 733Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex + insertLength), ref Unsafe.Add(ref _firstChar, startIndex), (nuint)(oldLength - startIndex)); 1120ref char dest = ref Unsafe.Add(ref result._firstChar, copiedLength); 1156new Span<char>(ref result._firstChar, count).Fill(paddingChar); 1157Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, count), ref _firstChar, (nuint)oldLength); 1174Buffer.Memmove(ref result._firstChar, ref _firstChar, (nuint)oldLength); 1175new Span<char>(ref Unsafe.Add(ref result._firstChar, oldLength), count).Fill(paddingChar); 1195Buffer.Memmove(ref result._firstChar, ref _firstChar, (nuint)startIndex); 1196Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex), ref Unsafe.Add(ref _firstChar, startIndex + count), (nuint)(newLength - startIndex)); 1308Buffer.Memmove(ref result._firstChar, ref _firstChar, (uint)copyLength); 1376int pos = PackedSpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, i), c, Length - i); 1389int pos = SpanHelpers.NonPackedIndexOfChar(ref Unsafe.Add(ref _firstChar, i), c, Length - i); 1405int pos = SpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, i), Length - i, ref oldValue._firstChar, oldValue.Length); 1439Span<char> dstSpan = new Span<char>(ref dst._firstChar, dst.Length); 2562destination: ref result._firstChar, 2563source: ref Unsafe.Add(ref _firstChar, (nint)(uint)startIndex /* force zero-extension */));
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Searching.cs (13)
25ref _firstChar, 27ref value._firstChar, 39=> SpanHelpers.ContainsValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length); 76public int IndexOf(char value) => SpanHelpers.IndexOfChar(ref _firstChar, value, Length); 141ref char startChar = ref Unsafe.Add(ref _firstChar, startIndex); 176int result = SpanHelpers.IndexOfChar(ref Unsafe.Add(ref _firstChar, startIndex), value, count); 191return new ReadOnlySpan<char>(ref _firstChar, Length).IndexOfAny(anyOf); 216int result = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, startIndex), count).IndexOfAny(anyOf); 452=> SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length); 477int result = SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref Unsafe.Add(ref _firstChar, startSearchAt)), (short)value, count); 557ref char startChar = ref Unsafe.Add(ref _firstChar, startSearchAt); 595return new ReadOnlySpan<char>(ref _firstChar, Length).LastIndexOfAny(anyOf); 626int result = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, startSearchAt), count).LastIndexOfAny(anyOf);
11 references to _firstChar
System.Private.CoreLib (11)
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (9)
62if (strA._firstChar != strB._firstChar) goto DiffOffset0; 96return strA._firstChar - strB._firstChar; 1072if (this.Length < value.Length || _firstChar != value._firstChar) 1117return _firstChar == value; 1120return Length != 0 && _firstChar == value; 1151return Length > 1 && _firstChar == highSurrogate && this[1] == lowSurrogate;
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (2)
2679if (Length == 0 || (!char.IsWhiteSpace(_firstChar) && !char.IsWhiteSpace(this[^1]))) 2689if (Length == 0 || (_firstChar != trimChar && this[^1] != trimChar))