Span<T>.Equals(Object) Span<T>.Equals(Object) Span<T>.Equals(Object) Span<T>.Equals(Object) Method

定义

警告

此 API 现已过时。

不支持对此方法的调用。Calls to this method are not supported.

public:
 override bool Equals(System::Object ^ obj);
[System.Obsolete("Equals() on Span will always throw an exception. Use == instead.")]
public override bool Equals (object obj);
override this.Equals : obj -> bool
Public Overrides Function Equals (obj As Object) As Boolean

参数

obj
Object Object Object Object

不支持。Not supported.

返回

不支持对此方法的调用。Calls to this method are not supported.

异常

不支持对此方法的调用。Calls to this method are not supported.

注解

不支持对Equals方法的调用。Calls to the Equals method are not supported. Equals对方法的调用会产生两个结果:Calls to the Equals methods produce either of two results:

  • obj 如果Span<T>是, 则方法调用会生成编译器错误 CS1503: "无法从 ' system.object ' 转换为 ' object '。"这是因为Span<T>是一个不能装箱的ref 结构, 因此无法Object将其转换为。If obj is a Span<T>, the method call generates compiler error CS1503: "cannot convert from 'System.Span' to 'object'." This is because Span<T> is a ref struct that cannot be boxed and therefore cannot be converted to an Object.

  • 如果的类型obj Span<T>不是, 则方法调用将引发NotSupportedExceptionIf the type of obj is not a Span<T>, the method call throws a NotSupportedException.

若要比较Span<T>两个对象是否相等, Equality请使用比较运算符。To compare two Span<T> objects for equality, use the Equality comparison operator.

适用于