PostSharp//API Reference/Post­Sharp.​Reflection/Reflection­Search/Get­Declarations­Used­By­Method
Open sandboxFocus

Method GetDeclarationsUsedByMethod

GetDeclarationsUsedByMethod(MethodBase)

Gets all declarations (Type, FieldInfo, MethodInfo or ConstructorInfo) used by the body of a given method or constructor.

Declaration
public static MethodUsageCodeReference[] GetDeclarationsUsedByMethod(MethodBase method)
Parameters
Type Name Description
MethodBase method

A MethodInfo or ConstructorInfo.

Returns
Type Description
MethodUsageCodeReference[]

An array of MethodUsageCodeReference containing one item for each declaration used by the body of method.

GetDeclarationsUsedByMethod(MethodBase, ReflectionSearchOptions)

Gets all declarations (Type, FieldInfo, MethodInfo or ConstructorInfo) used by the body of a given method or constructor and specifies additional options.

Declaration
public static MethodUsageCodeReference[] GetDeclarationsUsedByMethod(MethodBase method, ReflectionSearchOptions options)
Parameters
Type Name Description
MethodBase method

A MethodInfo or ConstructorInfo.

ReflectionSearchOptions options

This parameter has no effect and is kept only for backwards compatibility.

Returns
Type Description
MethodUsageCodeReference[]

An array of MethodUsageCodeReference containing one item for each declaration used by the body of method.