PostSharpAPI ReferencePost­Sharp.​ReflectionReflection­SearchGet­Declarations­Used­By­Method
Open sandboxFocus

ReflectionSearch.GetDeclarationsUsedByMethod Method

GetDeclarationsUsedByMethod(MethodBase)

Gets all declarations (System.Type, System.Reflection.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
System.Reflection.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.

Remarks

note

This feature is available only at build time.

GetDeclarationsUsedByMethod(MethodBase, ReflectionSearchOptions)

Gets all declarations (System.Type, System.Reflection.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
System.Reflection.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.

Remarks

note

This feature is available only at build time.