تخطَّ إلى المحتوى

Exception thrown from an unexpected member (CA1065)

هذا المحتوى غير متوفر بلغتك بعد.

Key dotnet.exception.unexpected-throw · Severity warning · Category exception

Microsoft analyzer CA1065. Flags exceptions thrown from members callers never guard - Equals, GetHashCode, ToString, property getters, static constructors, finalizers, Dispose.

public override bool Equals(object? obj)
{
if (obj is not Money m) throw new ArgumentException("Not money");
return Amount == m.Amount;
}
public override bool Equals(object? obj) => obj is Money m && Amount == m.Amount;