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

Id

struct Id : IEquatable<Id>
Identifier struct.
using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; namespace System.Private.Windows { internal readonly struct Id : IEquatable<Id> { private readonly int _id; private readonly bool _isNull; public static Id Null => new Id(true); public bool IsNull => _isNull; private Id(int id) { _isNull = true; _id = id; _isNull = false; } private Id(bool isNull) { _isNull = true; _id = 0; _isNull = isNull; } public static implicit operator int(Id value) { if (!value._isNull) return value._id; throw new InvalidOperationException(); } public static implicit operator Id(int value) { return new Id(value); } [NullableContext(2)] public override bool Equals([NotNullWhen(true)] object obj) { if (obj is Id) { Id other = (Id)obj; if (Equals(other)) return true; } if (obj is int) { int num = (int)obj; return num == _id; } return false; } public bool Equals(Id other) { if (_isNull == other._isNull) return _id == other._id; return false; } public override int GetHashCode() { return _id.GetHashCode(); } [NullableContext(1)] public override string ToString() { if (!_isNull) return _id.ToString(); return "<null>"; } public static bool operator ==(Id left, Id right) { return left.Equals(right); } public static bool operator !=(Id left, Id right) { return !(left == right); } } }