Class MetadataHelper

Helper class to use for retrieving metadata about a plugin, defined as attributes.

Inheritance
System.Object MetadataHelper
Inherited Members
System.Object.ToString() System.Object.Equals(System.Object) System.Object.Equals(System.Object, System.Object) System.Object.ReferenceEquals(System.Object, System.Object) System.Object.GetHashCode() System.Object.GetType() System.Object.MemberwiseClone()
Namespace: BepInEx
Assembly: BepInEx.Core.dll
Syntax
public static class MetadataHelper

Methods

GetAttributes<T>(Object)

Gets the specified attributes of an instance, if they exist.

Declaration
public static IEnumerable<T> GetAttributes<T>(object plugin)
    where T : Attribute
Parameters
Type Name Description
System.Object plugin

The plugin instance.

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

The attributes of the instance, if existing.

Type Parameters
Name Description
T

The attribute type to retrieve.

GetAttributes<T>(Assembly)

Gets the specified attributes of an assembly, if they exist.

Declaration
public static T[] GetAttributes<T>(Assembly assembly)
    where T : Attribute
Parameters
Type Name Description
System.Reflection.Assembly assembly

The assembly.

Returns
Type Description
T[]

The attributes of the type, if existing.

Type Parameters
Name Description
T

The attribute type to retrieve.

GetAttributes<T>(MemberInfo)

Gets the specified attributes of a reflection metadata type, if they exist.

Declaration
public static T[] GetAttributes<T>(MemberInfo member)
    where T : Attribute
Parameters
Type Name Description
System.Reflection.MemberInfo member

The reflection metadata instance.

Returns
Type Description
T[]

The attributes of the instance, if existing.

Type Parameters
Name Description
T

The attribute type to retrieve.

GetAttributes<T>(Type)

Gets the specified attributes of a type, if they exist.

Declaration
public static T[] GetAttributes<T>(Type pluginType)
    where T : Attribute
Parameters
Type Name Description
System.Type pluginType

The plugin type.

Returns
Type Description
T[]

The attributes of the type, if existing.

Type Parameters
Name Description
T

The attribute type to retrieve.

GetDependencies(Type)

Retrieves the dependencies of the specified plugin type.

Declaration
public static IEnumerable<BepInDependency> GetDependencies(Type plugin)
Parameters
Type Name Description
System.Type plugin

The plugin type.

Returns
Type Description
System.Collections.Generic.IEnumerable<BepInDependency>

A list of all plugin types that the specified plugin type depends upon.

GetMetadata(Object)

Retrieves the BepInPlugin metadata from a plugin instance.

Declaration
public static BepInPlugin GetMetadata(object plugin)
Parameters
Type Name Description
System.Object plugin

The plugin instance.

Returns
Type Description
BepInPlugin

The BepInPlugin metadata of the plugin instance.

GetMetadata(Type)

Retrieves the BepInPlugin metadata from a plugin type.

Declaration
public static BepInPlugin GetMetadata(Type pluginType)
Parameters
Type Name Description
System.Type pluginType

The plugin type.

Returns
Type Description
BepInPlugin

The BepInPlugin metadata of the plugin type.