Wrapper

Ecng.Common

Represents an abstract wrapper class for a value of type that supports equality, cloning, and disposal.

继承自: Equatable<Wrapper<T>>

实现: IDisposable

构造函数

Wrapper
protected Wrapper()
wrapper = Wrapper()

Initializes a new instance of the Wrapper class.

Wrapper
protected Wrapper(T value)
wrapper = Wrapper(value)

Initializes a new instance of the Wrapper class with the specified value.

value
The value to wrap.

属性

HasValue
public bool HasValue { get; }
value = wrapper.HasValue

Gets a value indicating whether the wrapped value is not equal to the default value of type .

IsDisposed
public bool IsDisposed { get; private set; }
value = wrapper.IsDisposed
wrapper.IsDisposed = value

Gets a value indicating whether this instance has already been disposed.

Value
public virtual T Value { get; set; }
value = wrapper.Value
wrapper.Value = value

Gets or sets the wrapped value.

方法

Dispose
public void Dispose()
wrapper.Dispose()

Releases all resources used by the current instance.

DisposeManaged
protected virtual void DisposeManaged()
wrapper.DisposeManaged()

Releases managed resources used by the current instance.

DisposeNative
protected virtual void DisposeNative()
wrapper.DisposeNative()

Releases unmanaged (native) resources used by the current instance.

Finalize
protected override void Finalize()
wrapper.Finalize()

Finalizes an instance of the Wrapper class.

GetHashCode
public override int GetHashCode()
result = wrapper.GetHashCode()

Returns a hash code for this instance based on the wrapped value.

返回值: A hash code for the current object.

OnEquals
protected override bool OnEquals(Wrapper<T> other)
result = wrapper.OnEquals(other)

Determines whether the wrapped value of this instance equals the wrapped value of another instance.

other
Another instance of Wrapper to compare with.

返回值: true if the wrapped values are equal; otherwise, false.

op_Explicit(Wrapper{) : T

Defines an explicit conversion operator from Wrapper to .

wrapper
The wrapper instance.

返回值: The wrapped value.

ToString
public override string ToString()
result = wrapper.ToString()

Returns a string that represents the current instance.

返回值: A string representation of the wrapped value, or an empty string if no value is present.