Class RoslynMethodInfo
Namespace: Neon.Roslyn
Assembly: Neon.Roslyn.dll
Syntax
public class RoslynMethodInfo : MethodInfo
Constructors
RoslynMethodInfo(IMethodSymbol, MetadataLoadContext)
Declaration
public RoslynMethodInfo(IMethodSymbol method, MetadataLoadContext metadataLoadContext)
Parameters
Type | Name | Description |
---|---|---|
IMethodSymbol | method | |
MetadataLoadContext | metadataLoadContext |
Properties
Attributes
Gets the attributes associated with this method.
Declaration
public override MethodAttributes Attributes { get; }
Property Value
Type | Description |
---|---|
MethodAttributes | One of the MethodAttributes values. |
Overrides
DeclaringType
Gets the class that declares this member.
Declaration
public override Type DeclaringType { get; }
Property Value
Type | Description |
---|---|
Type | The |
Overrides
IsGenericMethod
Gets a value indicating whether the method is generic.
Declaration
public override bool IsGenericMethod { get; }
Property Value
Type | Description |
---|---|
bool | true if the current MethodBase represents a generic method; otherwise, false. |
Overrides
MethodHandle
Gets a handle to the internal metadata representation of a method.
Declaration
public override RuntimeMethodHandle MethodHandle { get; }
Property Value
Type | Description |
---|---|
RuntimeMethodHandle | A RuntimeMethodHandle object. |
Overrides
MethodSymbol
Declaration
public IMethodSymbol MethodSymbol { get; }
Property Value
Type | Description |
---|---|
IMethodSymbol |
Name
Gets the name of the current member.
Declaration
public override string Name { get; }
Property Value
Type | Description |
---|---|
string | A string containing the name of this member. |
Overrides
ReflectedType
Gets the class object that was used to obtain this instance of MemberInfo
.
Declaration
public override Type ReflectedType { get; }
Property Value
Type | Description |
---|---|
Type | The |
Overrides
ReturnType
Gets the return type of this method.
Declaration
public override Type ReturnType { get; }
Property Value
Type | Description |
---|---|
Type | The return type of this method. |
Overrides
ReturnTypeCustomAttributes
Gets the custom attributes for the return type.
Declaration
public override ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
Property Value
Type | Description |
---|---|
ICustomAttributeProvider | An |
Overrides
Methods
GetBaseDefinition()
When overridden in a derived class, returns the MethodInfo object for the method on the direct or indirect base class in which the method represented by this instance was first declared.
Declaration
public override MethodInfo GetBaseDefinition()
Returns
Type | Description |
---|---|
MethodInfo | A MethodInfo object for the first implementation of this method. |
Overrides
GetCustomAttributes(bool)
When overridden in a derived class, returns an array of all custom attributes applied to this member.
Declaration
public override object[] GetCustomAttributes(bool inherit)
Parameters
Type | Name | Description |
---|---|---|
bool | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events. |
Returns
Type | Description |
---|---|
object[] | An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined. |
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException | This member belongs to a type that is loaded into the reflection-only context. See How to: Load Assemblies into the Reflection-Only Context. |
TypeLoadException | A custom attribute type could not be loaded. |
GetCustomAttributes(Type, bool)
When overridden in a derived class, returns an array of custom attributes applied to this member and identified by Type.
Declaration
public override object[] GetCustomAttributes(Type attributeType, bool inherit)
Parameters
Type | Name | Description |
---|---|---|
Type | attributeType | The type of attribute to search for. Only attributes that are assignable to this type are returned. |
bool | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events. |
Returns
Type | Description |
---|---|
object[] | An array of custom attributes applied to this member, or an array with zero elements if no attributes assignable to |
Overrides
Exceptions
Type | Condition |
---|---|
TypeLoadException | A custom attribute type cannot be loaded. |
ArgumentNullException | If |
InvalidOperationException | This member belongs to a type that is loaded into the reflection-only context. See How to: Load Assemblies into the Reflection-Only Context. |
GetCustomAttributesData()
Returns a list of CustomAttributeData objects representing data about the attributes that have been applied to the target member.
Declaration
public override IList<CustomAttributeData> GetCustomAttributesData()
Returns
Type | Description |
---|---|
IList<CustomAttributeData> | A generic list of CustomAttributeData objects representing data about the attributes that have been applied to the target member. |
Overrides
GetGenericArguments()
Returns an array of Type objects that represent the type arguments of a generic method or the type parameters of a generic method definition.
Declaration
public override Type[] GetGenericArguments()
Returns
Type | Description |
---|---|
Type[] | An array of Type objects that represent the type arguments of a generic method or the type parameters of a generic method definition. Returns an empty array if the current method is not a generic method. |
Overrides
Exceptions
Type | Condition |
---|---|
NotSupportedException | This method is not supported. |
GetMethodImplementationFlags()
When overridden in a derived class, returns the MethodImplAttributes flags.
Declaration
public override MethodImplAttributes GetMethodImplementationFlags()
Returns
Type | Description |
---|---|
MethodImplAttributes | The |
Overrides
GetParameters()
When overridden in a derived class, gets the parameters of the specified method or constructor.
Declaration
public override ParameterInfo[] GetParameters()
Returns
Type | Description |
---|---|
ParameterInfo[] | An array of type |
Overrides
Invoke(object, BindingFlags, Binder, object[], CultureInfo)
When overridden in a derived class, invokes the reflected method or constructor with the given parameters.
Declaration
public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
Parameters
Type | Name | Description |
---|---|---|
object | obj | The object on which to invoke the method or constructor. If a method is static, this argument is ignored. If a constructor is static, this argument must be null or an instance of the class that defines the constructor. |
BindingFlags | invokeAttr | A bitmask that is a combination of 0 or more bit flags from BindingFlags. If |
Binder | binder | An object that enables the binding, coercion of argument types, invocation of members, and retrieval of |
object[] | parameters | An argument list for the invoked method or constructor. This is an array of objects with the same number, order, and type as the parameters of the method or constructor to be invoked. If there are no parameters, this should be null. If the method or constructor represented by this instance takes a ByRef parameter, there is no special attribute required for that parameter in order to invoke the method or constructor using this function. Any object in this array that is not explicitly initialized with a value will contain the default value for that object type. For reference-type elements, this value is null. For value-type elements, this value is 0, 0.0, or false, depending on the specific element type. |
CultureInfo | culture | An instance of |
Returns
Type | Description |
---|---|
object | An |
Overrides
Exceptions
Type | Condition |
---|---|
TargetException | The -or- The method is not declared or inherited by the class of -or- A static constructor is invoked, and |
ArgumentException | The type of the |
TargetParameterCountException | The |
TargetInvocationException | The invoked method or constructor throws an exception. |
MethodAccessException | The caller does not have permission to execute the method or constructor that is represented by the current instance. |
InvalidOperationException | The type that declares the method is an open generic type. That is, the ContainsGenericParameters property returns true for the declaring type. |
IsDefined(Type, bool)
When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member.
Declaration
public override bool IsDefined(Type attributeType, bool inherit)
Parameters
Type | Name | Description |
---|---|---|
Type | attributeType | The type of custom attribute to search for. The search includes derived types. |
bool | inherit | true to search this member's inheritance chain to find the attributes; otherwise, false. This parameter is ignored for properties and events. |
Returns
Type | Description |
---|---|
bool | true if one or more instances of |
Overrides
MakeGenericMethod(params Type[])
Substitutes the elements of an array of types for the type parameters of the current generic method definition, and returns a MethodInfo object representing the resulting constructed method.
Declaration
public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
Parameters
Type | Name | Description |
---|---|---|
Type[] | typeArguments | An array of types to be substituted for the type parameters of the current generic method definition. |
Returns
Type | Description |
---|---|
MethodInfo | A MethodInfo object that represents the constructed method formed by substituting the elements of |
Overrides
Exceptions
Type | Condition |
---|---|
InvalidOperationException | The current MethodInfo does not represent a generic method definition. That is, IsGenericMethodDefinition returns false. |
ArgumentNullException |
-or- Any element of |
ArgumentException | The number of elements in -or- An element of |
NotSupportedException | This method is not supported. |
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string | A string that represents the current object. |