<PackageReference Include="System.Drawing.Common" Version="10.0.0-preview.6.25358.103" />

CharacterRange

Specifies a range of character positions within a string.
using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; namespace System.Drawing { public struct CharacterRange : IEquatable<CharacterRange> { private int _first; private int _length; public int First { [IsReadOnly] get { return _first; } set { _first = value; } } public int Length { [IsReadOnly] get { return _length; } set { _length = value; } } public CharacterRange(int First, int Length) { _first = First; _length = Length; } [IsReadOnly] [NullableContext(2)] public override bool Equals([NotNullWhen(true)] object obj) { if (obj is CharacterRange) { CharacterRange other = (CharacterRange)obj; return Equals(other); } return false; } [IsReadOnly] public bool Equals(CharacterRange other) { if (First == other.First) return Length == other.Length; return false; } public static bool operator ==(CharacterRange cr1, CharacterRange cr2) { return cr1.Equals(cr2); } public static bool operator !=(CharacterRange cr1, CharacterRange cr2) { return !cr1.Equals(cr2); } [IsReadOnly] public override int GetHashCode() { return HashCode.Combine(First, Length); } } }