Class InstanceMethod
Encapsulates an instance method. This is essentially an Adapter over System.Reflection.MethodInfo.
Inheritance
Inherited Members
Namespace: AutoFixture.Kernel
Assembly: AutoFixture.dll
Syntax
public class InstanceMethod : IMethod, IEquatable<InstanceMethod>
Constructors
| Improve this Doc View SourceInstanceMethod(MethodInfo, Object)
Initializes a new instance of the InstanceMethod class.
Declaration
public InstanceMethod(MethodInfo instanceMethod, object owner)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MethodInfo | instanceMethod | The instance method. |
System.Object | owner | The owner. |
Remarks
The owner is expected to expose the method designated by
instanceMethod
. If not, the Invoke(IEnumerable<Object>) method will fail.
See Also
Properties
| Improve this Doc View SourceMethod
Gets the method originally supplied through the constructor.
Declaration
public MethodInfo Method { get; }
Property Value
Type | Description |
---|---|
System.Reflection.MethodInfo |
See Also
| Improve this Doc View SourceOwner
Gets the owner originally supplied through the constructor.
Declaration
public object Owner { get; }
Property Value
Type | Description |
---|---|
System.Object |
See Also
| Improve this Doc View SourceParameters
Gets information about the parameters of the method.
Declaration
public IEnumerable<ParameterInfo> Parameters { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Reflection.ParameterInfo> |
Methods
| Improve this Doc View SourceEquals(InstanceMethod)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(InstanceMethod other)
Parameters
Type | Name | Description |
---|---|---|
InstanceMethod | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the current object is equal to the |
Equals(Object)
Determines whether the specified System.Object is equal to this instance.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj | The System.Object to compare with this instance. |
Returns
Type | Description |
---|---|
System.Boolean | true if the specified System.Object is equal to this instance; otherwise, false. |
Overrides
Exceptions
Type | Condition |
---|---|
System.NullReferenceException | The |
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |
Overrides
Invoke(IEnumerable<Object>)
Invokes the method with the supplied parameters.
Declaration
public object Invoke(IEnumerable<object> parameters)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Object> | parameters | The parameters. |
Returns
Type | Description |
---|---|
System.Object | The result of the method call. |