<PackageReference Include="System.Drawing.Common" Version="9.0.5" />

Count

struct Count : IEquatable<Count>
Positive int enforcing count of items.
using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; namespace System.Private.Windows.Core { internal readonly struct Count : IEquatable<Count> { private readonly int _count; public static Count Zero { get; } = 0; public static Count One { get; } = 1; private Count(int count) { ArgumentOutOfRangeException.ThrowIfNegative(count, "count"); _count = count; } public static implicit operator int(Count value) { return value._count; } public static implicit operator Count(int value) { return new Count(value); } [NullableContext(2)] public override bool Equals([NotNullWhen(true)] object obj) { if (obj is Count) { Count other = (Count)obj; if (Equals(other)) return true; } if (obj is int) { int num = (int)obj; return num == _count; } return false; } public bool Equals(Count other) { return _count == other._count; } public override int GetHashCode() { return _count.GetHashCode(); } [NullableContext(1)] public override string ToString() { return _count.ToString(); } public static bool operator ==(Count left, Count right) { return left._count == right._count; } public static bool operator !=(Count left, Count right) { return !(left == right); } } }