MetadataProvider.GetMetadata Method
- Namespace
- Kampute.DocToolkit.Metadata
- Assembly
- Kampute.DocToolkit.dll
| GetMetadata(this Assembly) | Retrieves metadata for an assembly. |
| GetMetadata(this Type) | Retrieves metadata for a type. |
| GetMetadata(this ConstructorInfo) | Retrieves metadata for a constructor. |
| GetMetadata(this PropertyInfo) | Retrieves metadata for a property. |
| GetMetadata(this EventInfo) | Retrieves metadata for the specified event. |
| GetMetadata(this FieldInfo) | Retrieves metadata for a field. |
| GetMetadata(this MemberInfo) | Retrieves metadata for a member. |
| GetMetadata(this MethodInfo, bool) | Retrieves metadata for a method. |
| GetMetadata<T>(this Type) | Retrieves metadata for a type, cast to a specific type. |
GetMetadata(this Assembly)
Retrieves metadata for an assembly.
public static IAssembly GetMetadata(this Assembly assembly)Parameters
assemblyAssembly- The assembly to get metadata for.
Returns
- IAssembly
- An assembly metadata abstraction.
Exceptions
- ArgumentNullException
- Thrown when
assemblyisnull.
GetMetadata(this Type)
Retrieves metadata for a type.
public static IType GetMetadata(this Type type)Parameters
typeType- The type to get metadata for.
Returns
- IType
- A type metadata abstraction.
Exceptions
- ArgumentNullException
- Thrown when
typeisnull.
GetMetadata(this ConstructorInfo)
Retrieves metadata for a constructor.
public static IConstructor GetMetadata(this ConstructorInfo constructorInfo)Parameters
constructorInfoConstructorInfo- The constructor to get metadata for.
Returns
- IConstructor
- A constructor metadata abstraction.
Exceptions
- ArgumentNullException
- Thrown when
constructorInfoisnull.
GetMetadata(this PropertyInfo)
Retrieves metadata for a property.
public static IProperty GetMetadata(this PropertyInfo propertyInfo)Parameters
propertyInfoPropertyInfo- The property to get metadata for.
Returns
- IProperty
- A property metadata abstraction.
Exceptions
- ArgumentNullException
- Thrown when
propertyInfoisnull.
GetMetadata(this EventInfo)
Retrieves metadata for the specified event.
public static IEvent GetMetadata(this EventInfo eventInfo)Parameters
eventInfoEventInfo- The event to get metadata for.
Returns
- IEvent
- An event metadata abstraction.
Exceptions
- ArgumentNullException
- Thrown when
eventInfoisnull.
GetMetadata(this FieldInfo)
Retrieves metadata for a field.
public static IField GetMetadata(this FieldInfo fieldInfo)Parameters
fieldInfoFieldInfo- The field to get metadata for.
Returns
- IField
- A field metadata abstraction.
Exceptions
- ArgumentNullException
- Thrown when
fieldInfoisnull.
GetMetadata(this MemberInfo)
Retrieves metadata for a member.
public static IMember GetMetadata(this MemberInfo memberInfo)Parameters
memberInfoMemberInfo- The member to get metadata for.
Returns
- IMember
- A member metadata abstraction.
Exceptions
- ArgumentNullException
- Thrown when
memberInfoisnull. - NotSupportedException
- Thrown the member's type is not supported.
Remarks
GetMetadata(this MethodInfo, bool)
Retrieves metadata for a method.
public static IMethodBase GetMetadata(this MethodInfo methodInfo, bool asDeclared = false)Parameters
methodInfoMethodInfo- The method to get metadata for.
asDeclaredbool optional- Indicates whether to retrieve extension methods in their declared form rather than their usage form.
Returns
- IMethodBase
- A method or operator metadata abstraction.
Exceptions
- ArgumentNullException
- Thrown when
methodInfoisnull.
Remarks
When
asDeclared is false (the default), extension methods are detected and resolved to reflect their usage form rather than their declared form. Otherwise, the metadata is retrieved as declared, without extension method detection and resolution.GetMetadata<T>(this Type)
Retrieves metadata for a type, cast to a specific type.
public static T GetMetadata<T>(this Type type)
where T : class, ITypeType Parameters
T- The specific type of metadata to retrieve.
Parameters
typeType- The type to get metadata for.
Returns
- T
- A type metadata abstraction of the specified type.
Exceptions
- ArgumentNullException
- Thrown when
typeisnull. - InvalidCastException
- Thrown when the retrieved metadata cannot be cast to type
T.

memberInfocan represent any member type, including types, constructors, methods, properties, events, and fields. If thememberInfocorresponds to an accessor of an extension property, the method will resolve and return the appropriate property metadata.