Class InstanceMethod

Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll

Encapsulates an instance method. This is essentially an Adapter over MethodInfo.

public class InstanceMethod : IMethod, IEquatable<InstanceMethod>

Inheritance

objectInstanceMethod

Implements

IMethod, IEquatable<InstanceMethod>

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

InstanceMethod(MethodInfo, object)

Initializes a new instance of the InstanceMethod class.

public InstanceMethod(MethodInfo instanceMethod, object owner)

Parameters

instanceMethod MethodInfo

The instance method.

owner object

The owner.

Remarks

The owner is expected to expose the method designated by instanceMethod. If not, the `Object%7d)` method will fail.

See Also

InstanceMethod.Invoke(IEnumerable<object>), InstanceMethod.Method, InstanceMethod.Owner

Properties

Method

Gets the method originally supplied through the constructor.

public MethodInfo Method { get; }

Property Value

MethodInfo

See Also

InstanceMethod.InstanceMethod(MethodInfo, object)

Owner

Gets the owner originally supplied through the constructor.

public object Owner { get; }

Property Value

object

See Also

InstanceMethod.InstanceMethod(MethodInfo, object)

Parameters

Gets information about the parameters of the method.

public IEnumerable<ParameterInfo> Parameters { get; }

Property Value

IEnumerable<ParameterInfo>

Methods

Equals(object)

Determines whether the specified Object is equal to this instance.

public override bool Equals(object obj)

Parameters

obj object

The Object to compare with this instance.

Returns

bool

true if the specified Object is equal to this instance; otherwise, false.

Exceptions

NullReferenceException

The obj parameter is null.

Equals(InstanceMethod)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(InstanceMethod other)

Parameters

other InstanceMethod

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Invoke(IEnumerable<object>)

Invokes the method with the supplied parameters.

public object Invoke(IEnumerable<object> parameters)

Parameters

parameters IEnumerable<object>

The parameters.

Returns

object

The result of the method call.