Auf Englisch lesen

Teilen über


INumber<TSelf> Schnittstelle

Definition

Definiert einen Zahlentyp.

C#
public interface INumber<TSelf> : IComparable, IComparable<TSelf>, IEquatable<TSelf>, IParsable<TSelf>, ISpanParsable<TSelf>, IUtf8SpanParsable<TSelf>, System.Numerics.IAdditionOperators<TSelf,TSelf,TSelf>, System.Numerics.IAdditiveIdentity<TSelf,TSelf>, System.Numerics.IComparisonOperators<TSelf,TSelf,bool>, System.Numerics.IDecrementOperators<TSelf>, System.Numerics.IDivisionOperators<TSelf,TSelf,TSelf>, System.Numerics.IEqualityOperators<TSelf,TSelf,bool>, System.Numerics.IIncrementOperators<TSelf>, System.Numerics.IModulusOperators<TSelf,TSelf,TSelf>, System.Numerics.IMultiplicativeIdentity<TSelf,TSelf>, System.Numerics.IMultiplyOperators<TSelf,TSelf,TSelf>, System.Numerics.INumberBase<TSelf>, System.Numerics.ISubtractionOperators<TSelf,TSelf,TSelf>, System.Numerics.IUnaryNegationOperators<TSelf,TSelf>, System.Numerics.IUnaryPlusOperators<TSelf,TSelf> where TSelf : INumber<TSelf>
C#
public interface INumber<TSelf> : IComparable, IComparable<TSelf>, IEquatable<TSelf>, IParsable<TSelf>, ISpanParsable<TSelf>, System.Numerics.IAdditionOperators<TSelf,TSelf,TSelf>, System.Numerics.IAdditiveIdentity<TSelf,TSelf>, System.Numerics.IComparisonOperators<TSelf,TSelf,bool>, System.Numerics.IDecrementOperators<TSelf>, System.Numerics.IDivisionOperators<TSelf,TSelf,TSelf>, System.Numerics.IEqualityOperators<TSelf,TSelf,bool>, System.Numerics.IIncrementOperators<TSelf>, System.Numerics.IModulusOperators<TSelf,TSelf,TSelf>, System.Numerics.IMultiplicativeIdentity<TSelf,TSelf>, System.Numerics.IMultiplyOperators<TSelf,TSelf,TSelf>, System.Numerics.INumberBase<TSelf>, System.Numerics.ISubtractionOperators<TSelf,TSelf,TSelf>, System.Numerics.IUnaryNegationOperators<TSelf,TSelf>, System.Numerics.IUnaryPlusOperators<TSelf,TSelf> where TSelf : INumber<TSelf>

Typparameter

TSelf

Der Typ, der die Schnittstelle implementiert.

Abgeleitet
Implementiert

Methoden

Clamp(TSelf, TSelf, TSelf)

Klammert einen Wert auf einen inklusiven Minimal- und Maximalwert.

ClampNative(TSelf, TSelf, TSelf)

Definiert einen Zahlentyp.

CompareTo(Object)

Vergleicht die aktuelle Instanz mit einem anderen Objekt desselben Typs und gibt eine ganze Zahl zurück, die angibt, ob die aktuelle Instanz vorgeht, folgt oder in derselben Position in der Sortierreihenfolge wie das andere Objekt auftritt.

(Geerbt von IComparable)
CompareTo(T)

Vergleicht die aktuelle Instanz mit einem anderen Objekt desselben Typs und gibt eine ganze Zahl zurück, die angibt, ob die aktuelle Instanz vorgeht, folgt oder in derselben Position in der Sortierreihenfolge wie das andere Objekt auftritt.

(Geerbt von IComparable<T>)
CopySign(TSelf, TSelf)

Kopiert das Vorzeichen eines Werts in das Vorzeichen eines anderen Werts.

Equals(T)

Gibt an, ob das aktuelle Objekt einem anderen Objekt desselben Typs entspricht.

(Geerbt von IEquatable<T>)
Max(TSelf, TSelf)

Vergleicht zwei Werte mit der Berechnung, die größer ist.

MaxNative(TSelf, TSelf)

Definiert einen Zahlentyp.

MaxNumber(TSelf, TSelf)

Vergleicht zwei Werte mit der Berechnung, die größer ist und den anderen Wert zurückgibt, wenn eine Eingabe NaNist.

Min(TSelf, TSelf)

Vergleicht zwei Werte mit der Berechnung, die kleiner ist.

MinNative(TSelf, TSelf)

Definiert einen Zahlentyp.

MinNumber(TSelf, TSelf)

Vergleicht zwei Werte mit der Berechnung, die kleiner ist und den anderen Wert zurückgibt, wenn eine Eingabe NaNist.

Sign(TSelf)

Berechnet das Vorzeichen eines Werts.

ToString(String, IFormatProvider)

Formatiert den Wert der aktuellen Instanz mithilfe des angegebenen Formats.

(Geerbt von IFormattable)
TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Versucht, den Wert der aktuellen Instanz als UTF-8 in die bereitgestellte Bytespanne zu formatieren.

(Geerbt von IUtf8SpanFormattable)
TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Versucht, den Wert der aktuellen Instanz in die bereitgestellte Zeichenspanne zu formatieren.

(Geerbt von ISpanFormattable)

Explizite Schnittstellenimplementierungen

IUtf8SpanFormattable.TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider)

Versucht, den Wert der aktuellen Instanz als UTF-8 in die bereitgestellte Bytespanne zu formatieren.

(Geerbt von INumberBase<TSelf>)
IUtf8SpanParsable<TSelf>.Parse(ReadOnlySpan<Byte>, IFormatProvider)

Analysiert eine Spanne von UTF-8 Zeichen in einen Wert.

(Geerbt von INumberBase<TSelf>)
IUtf8SpanParsable<TSelf>.TryParse(ReadOnlySpan<Byte>, IFormatProvider, TSelf)

Versucht, eine Spanne von UTF-8 Zeichen in einen Wert zu analysieren.

(Geerbt von INumberBase<TSelf>)

Gilt für:

Produkt Versionen
.NET 7, 8, 9, 10