public static Win32ErrorCode? ByCode()

in src/Zyborg.PassCore.PasswordProvider.LDAP/Win32ErrorCode.cs [100:121]


        public static Win32ErrorCode? ByCode(int code) =>
            ErrorByCode.TryGetValue(code, out var err) ? err : null;

        /// <summary>
        /// Returns a hash code for this instance.
        /// </summary>
        /// <returns>
        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. 
        /// </returns>
        public override int GetHashCode() => Code;

        /// <summary>
        /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
        /// </summary>
        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
        /// <returns>
        ///   <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public override bool Equals(object? obj)
        {
            return obj != null && obj is Win32ErrorCode err && Code == err.Code;
        }