INumber<TSelf> 接口

定义

定义数字类型。

generic <typename TSelf>
 where TSelf : INumber<TSelf>public interface class INumber : 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>
generic <typename TSelf>
 where TSelf : INumber<TSelf>public interface class INumber : 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>
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>
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>
type INumber<'Self (requires 'Self :> INumber<'Self>)> = interface
    interface IComparable
    interface IComparable<'Self (requires 'Self :> INumber<'Self>)>
    interface IEquatable<'Self (requires 'Self :> INumber<'Self>)>
    interface IFormattable
    interface IParsable<'Self (requires 'Self :> INumber<'Self>)>
    interface ISpanFormattable
    interface ISpanParsable<'Self (requires 'Self :> INumber<'Self>)>
    interface IAdditionOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IAdditiveIdentity<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IComparisonOperators<'Self, 'Self, bool (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IEqualityOperators<'Self, 'Self, bool (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IDecrementOperators<'Self (requires 'Self :> INumber<'Self>)>
    interface IDivisionOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IIncrementOperators<'Self (requires 'Self :> INumber<'Self>)>
    interface IModulusOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IMultiplicativeIdentity<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IMultiplyOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface INumberBase<'Self (requires 'Self :> INumber<'Self>)>
    interface ISubtractionOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IUnaryNegationOperators<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IUnaryPlusOperators<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
type INumber<'Self (requires 'Self :> INumber<'Self>)> = interface
    interface IComparable
    interface IComparable<'Self (requires 'Self :> INumber<'Self>)>
    interface IEquatable<'Self (requires 'Self :> INumber<'Self>)>
    interface IFormattable
    interface IParsable<'Self (requires 'Self :> INumber<'Self>)>
    interface ISpanFormattable
    interface ISpanParsable<'Self (requires 'Self :> INumber<'Self>)>
    interface IAdditionOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IAdditiveIdentity<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IComparisonOperators<'Self, 'Self, bool (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IEqualityOperators<'Self, 'Self, bool (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IDecrementOperators<'Self (requires 'Self :> INumber<'Self>)>
    interface IDivisionOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IIncrementOperators<'Self (requires 'Self :> INumber<'Self>)>
    interface IModulusOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IMultiplicativeIdentity<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IMultiplyOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface INumberBase<'Self (requires 'Self :> INumber<'Self>)>
    interface ISubtractionOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IUnaryNegationOperators<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IUnaryPlusOperators<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IUtf8SpanFormattable
    interface IUtf8SpanParsable<'Self (requires 'Self :> INumber<'Self>)>
type INumber<'Self (requires 'Self :> INumber<'Self>)> = interface
    interface IComparable
    interface IComparable<'Self (requires 'Self :> INumber<'Self>)>
    interface IEquatable<'Self (requires 'Self :> INumber<'Self>)>
    interface IFormattable
    interface IParsable<'Self (requires 'Self :> INumber<'Self>)>
    interface ISpanFormattable
    interface ISpanParsable<'Self (requires 'Self :> INumber<'Self>)>
    interface IAdditionOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IAdditiveIdentity<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IComparisonOperators<'Self, 'Self, bool (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IEqualityOperators<'Self, 'Self, bool (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IDecrementOperators<'Self (requires 'Self :> INumber<'Self>)>
    interface IDivisionOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IIncrementOperators<'Self (requires 'Self :> INumber<'Self>)>
    interface IModulusOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IMultiplicativeIdentity<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IMultiplyOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface INumberBase<'Self (requires 'Self :> INumber<'Self>)>
    interface IUtf8SpanFormattable
    interface IUtf8SpanParsable<'Self (requires 'Self :> INumber<'Self>)>
    interface ISubtractionOperators<'Self, 'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IUnaryNegationOperators<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
    interface IUnaryPlusOperators<'Self, 'Self (requires 'Self :> INumber<'Self> and 'Self :> INumber<'Self>)>
Public Interface INumber(Of TSelf)
Implements IAdditionOperators(Of TSelf, TSelf, TSelf), IAdditiveIdentity(Of TSelf, TSelf), IComparable, IComparable(Of TSelf), IComparisonOperators(Of TSelf, TSelf, Boolean), IDecrementOperators(Of TSelf), IDivisionOperators(Of TSelf, TSelf, TSelf), IEqualityOperators(Of TSelf, TSelf, Boolean), IEquatable(Of TSelf), IIncrementOperators(Of TSelf), IModulusOperators(Of TSelf, TSelf, TSelf), IMultiplicativeIdentity(Of TSelf, TSelf), IMultiplyOperators(Of TSelf, TSelf, TSelf), INumberBase(Of TSelf), IParsable(Of TSelf), ISpanParsable(Of TSelf), ISubtractionOperators(Of TSelf, TSelf, TSelf), IUnaryNegationOperators(Of TSelf, TSelf), IUnaryPlusOperators(Of TSelf, TSelf)
Public Interface INumber(Of TSelf)
Implements IAdditionOperators(Of TSelf, TSelf, TSelf), IAdditiveIdentity(Of TSelf, TSelf), IComparable, IComparable(Of TSelf), IComparisonOperators(Of TSelf, TSelf, Boolean), IDecrementOperators(Of TSelf), IDivisionOperators(Of TSelf, TSelf, TSelf), IEqualityOperators(Of TSelf, TSelf, Boolean), IEquatable(Of TSelf), IIncrementOperators(Of TSelf), IModulusOperators(Of TSelf, TSelf, TSelf), IMultiplicativeIdentity(Of TSelf, TSelf), IMultiplyOperators(Of TSelf, TSelf, TSelf), INumberBase(Of TSelf), IParsable(Of TSelf), ISpanParsable(Of TSelf), ISubtractionOperators(Of TSelf, TSelf, TSelf), IUnaryNegationOperators(Of TSelf, TSelf), IUnaryPlusOperators(Of TSelf, TSelf), IUtf8SpanParsable(Of TSelf)

类型参数

TSelf

实现 接口的类型。

派生
实现

方法

Clamp(TSelf, TSelf, TSelf)

将值固定为非独占最小值和最大值。

CompareTo(Object)

将当前实例与同一类型的另一个对象进行比较,并返回一个整数,该整数指示当前实例在排序顺序中的位置是位于另一个对象之前、之后还是与其位置相同。

(继承自 IComparable)
CompareTo(T)

将当前实例与同一类型的另一个对象进行比较,并返回一个整数,该整数指示当前实例在排序顺序中的位置是位于另一个对象之前、之后还是与其位置相同。

(继承自 IComparable<T>)
CopySign(TSelf, TSelf)

将值的符号复制到另一个值的符号。

Equals(T)

指示当前对象是否等于同一类型的另一个对象。

(继承自 IEquatable<T>)
Max(TSelf, TSelf)

将两个值与更大的计算进行比较。

MaxNumber(TSelf, TSelf)

比较两个值以计算较大值,如果输入为 , NaN则返回另一个值。

Min(TSelf, TSelf)

将两个值与较小的计算进行比较。

MinNumber(TSelf, TSelf)

将两个值进行比较以计算较小的值,如果输入为 NaN,则返回另一个值。

Sign(TSelf)

计算值的符号。

ToString(String, IFormatProvider)

使用指定格式对当前实例的值设置格式。

(继承自 IFormattable)
TryFormat(Span<Byte>, Int32, ReadOnlySpan<Char>, IFormatProvider)

尝试将当前实例的值格式化为 UTF-8,将其设置为提供的字节范围。

(继承自 IUtf8SpanFormattable)
TryFormat(Span<Char>, Int32, ReadOnlySpan<Char>, IFormatProvider)

尝试将当前实例的值格式化为提供的字符范围。

(继承自 ISpanFormattable)

显式接口实现

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

定义数字类型。

(继承自 INumberBase<TSelf>)
IUtf8SpanParsable<TSelf>.Parse(ReadOnlySpan<Byte>, IFormatProvider)

将 UTF-8 字符范围分析为值。

(继承自 INumberBase<TSelf>)
IUtf8SpanParsable<TSelf>.TryParse(ReadOnlySpan<Byte>, IFormatProvider, TSelf)

尝试将 UTF-8 字符范围解析为值。

(继承自 INumberBase<TSelf>)

适用于