Skip to content

MetadataHelper Class

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

C#
public static class MetadataHelper

Inheritance object

Retrieves the BepInPlugin metadata from a plugin type.

C#
public static BepInPlugin GetMetadata(Type pluginType)

pluginType Type
The plugin type.

BepInPlugin
The BepInPlugin metadata of the plugin type.

Retrieves the BepInPlugin metadata from a plugin instance.

C#
public static BepInPlugin GetMetadata(object plugin)

plugin object
The plugin instance.

BepInPlugin
The BepInPlugin metadata of the plugin instance.

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

C#
public static T[] GetAttributes<T>(Type pluginType) where T : Attribute

pluginType Type
The plugin type.

T[]
The attributes of the type, if existing.

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

C#
public static T[] GetAttributes<T>(Assembly assembly) where T : Attribute

assembly Assembly
The assembly.

T[]
The attributes of the type, if existing.

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

C#
public static IEnumerable<T> GetAttributes<T>(object plugin) where T : Attribute

plugin object
The plugin instance.

IEnumerable<T>
The attributes of the instance, if existing.

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

C#
public static T[] GetAttributes<T>(MemberInfo member) where T : Attribute

member MemberInfo
The reflection metadata instance.

T[]
The attributes of the instance, if existing.

Retrieves the dependencies of the specified plugin type.

C#
public static IEnumerable<BepInDependency> GetDependencies(Type plugin)

plugin Type
The plugin type.

IEnumerable<BepInDependency>
A list of all plugin types that the specified plugin type depends upon.