80 writes to _firstChar
System.Private.CoreLib (80)
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; 689return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref _firstChar), (uint)_stringLength * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32)); 700return Marvin.ComputeHash32OrdinalIgnoreCase(ref _firstChar, _stringLength /* in chars, not bytes */, (uint)seed, (uint)(seed >> 32)); 763fixed (char* src = &_firstChar) 860fixed (char* src = &_firstChar)
src\libraries\System.Private.CoreLib\src\System\String.cs (23)
85destination: ref result._firstChar, 111destination: ref result._firstChar, 137destination: ref result._firstChar, 171destination: ref result._firstChar, 300SpanHelpers.Fill(ref result._firstChar, (uint)count, c); 317Buffer.Memmove(ref result._firstChar, ref MemoryMarshal.GetReference(value), (uint)value.Length); 386slice = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, (nint)(uint)startIndex /* force zero-extension */), count); 405destination: ref result._firstChar, 406source: ref str._firstChar); 428source: ref Unsafe.Add(ref _firstChar, sourceIndex), 440Buffer.Memmove(ref destination._reference, ref _firstChar, (uint)Length); 457Buffer.Memmove(ref destination._reference, ref _firstChar, (uint)Length); 473source: ref _firstChar, 497source: ref Unsafe.Add(ref _firstChar, startIndex), 525public ref readonly char GetPinnableReference() => ref _firstChar; 527internal ref char GetRawStringData() => ref _firstChar; 528internal ref byte GetRawStringDataAsUInt8() => ref Unsafe.As<char, byte>(ref _firstChar); 529internal ref ushort GetRawStringDataAsUInt16() => ref Unsafe.As<char, ushort>(ref _firstChar); 549fixed (char* pTempChars = &s._firstChar) 565result._firstChar = c; 572result._firstChar = c1; 573Unsafe.Add(ref result._firstChar, 1) = c2; 735return Unsafe.Add(ref _firstChar, (nint)(uint)index /* force zero-extension */);
src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (32)
63destination: ref Unsafe.Add(ref dest._firstChar, destPos), 64source: ref src._firstChar, 296Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 313Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 335Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 360Span<char> resultSpan = new Span<char>(ref result._firstChar, result.Length); 708Buffer.Memmove(ref result._firstChar, ref _firstChar, (nuint)startIndex); 709Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex), ref value._firstChar, (nuint)insertLength); 710Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex + insertLength), ref Unsafe.Add(ref _firstChar, startIndex), (nuint)(oldLength - startIndex)); 1097ref char dest = ref Unsafe.Add(ref result._firstChar, copiedLength); 1133new Span<char>(ref result._firstChar, count).Fill(paddingChar); 1134Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, count), ref _firstChar, (nuint)oldLength); 1151Buffer.Memmove(ref result._firstChar, ref _firstChar, (nuint)oldLength); 1152new Span<char>(ref Unsafe.Add(ref result._firstChar, oldLength), count).Fill(paddingChar); 1172Buffer.Memmove(ref result._firstChar, ref _firstChar, (nuint)startIndex); 1173Buffer.Memmove(ref Unsafe.Add(ref result._firstChar, startIndex), ref Unsafe.Add(ref _firstChar, startIndex + count), (nuint)(newLength - startIndex)); 1285Buffer.Memmove(ref result._firstChar, ref _firstChar, (uint)copyLength); 1353int pos = PackedSpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, i), c, Length - i); 1366int pos = SpanHelpers.NonPackedIndexOfChar(ref Unsafe.Add(ref _firstChar, i), c, Length - i); 1382int pos = SpanHelpers.IndexOf(ref Unsafe.Add(ref _firstChar, i), Length - i, ref oldValue._firstChar, oldValue.Length); 1416Span<char> dstSpan = new Span<char>(ref dst._firstChar, dst.Length); 2345destination: ref result._firstChar, 2346source: ref Unsafe.Add(ref _firstChar, (nint)(uint)startIndex /* force zero-extension */));
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); 71public int IndexOf(char value) => SpanHelpers.IndexOfChar(ref _firstChar, value, Length); 136ref char startChar = ref Unsafe.Add(ref _firstChar, startIndex); 171int result = SpanHelpers.IndexOfChar(ref Unsafe.Add(ref _firstChar, startIndex), value, count); 186return new ReadOnlySpan<char>(ref _firstChar, Length).IndexOfAny(anyOf); 211int result = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, startIndex), count).IndexOfAny(anyOf); 446=> SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref _firstChar), (short)value, Length); 471int result = SpanHelpers.LastIndexOfValueType(ref Unsafe.As<char, short>(ref Unsafe.Add(ref _firstChar, startSearchAt)), (short)value, count); 551ref char startChar = ref Unsafe.Add(ref _firstChar, startSearchAt); 589return new ReadOnlySpan<char>(ref _firstChar, Length).LastIndexOfAny(anyOf); 620int result = new ReadOnlySpan<char>(ref Unsafe.Add(ref _firstChar, startSearchAt), count).LastIndexOfAny(anyOf);
src\System\String.CoreCLR.cs (1)
55fixed (char* pwzChar = &_firstChar)
10 references to _firstChar
System.Private.CoreLib (10)
src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (8)
62if (strA._firstChar != strB._firstChar) goto DiffOffset0; 96return strA._firstChar - strB._firstChar; 1065if (this.Length < value.Length || _firstChar != value._firstChar) 1110return _firstChar == value; 1113return Length != 0 && _firstChar == value;
src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (2)
2387if (Length == 0 || (!char.IsWhiteSpace(_firstChar) && !char.IsWhiteSpace(this[^1]))) 2397if (Length == 0 || (_firstChar != trimChar && this[^1] != trimChar))