Table of Contents

Class ClassScanner

Namespace
SampSharp.Entities
Assembly
SampSharp.OpenMp.Entities.dll

Represents a utility for scanning for classes and members with specific attributes in loaded assemblies.

public sealed class ClassScanner
Inheritance
ClassScanner
Inherited Members

Methods

Create()

Creates a new ClassScanner instance.

public static ClassScanner Create()

Returns

ClassScanner

A new scanner instance.

HasClassAttribute<T>()

Includes only members of classes which have an attribute T.

public ClassScanner HasClassAttribute<T>() where T : Attribute

Returns

ClassScanner

An updated scanner.

Type Parameters

T

The type of the attribute the class should have.

HasMemberAttribute<T>()

Includes only members which have an attribute T.

public ClassScanner HasMemberAttribute<T>() where T : Attribute

Returns

ClassScanner

An updated scanner.

Type Parameters

T

The type of the attribute the member should have.

Implements<T>()

Includes only members of classes which implement T in the scan.

public ClassScanner Implements<T>()

Returns

ClassScanner

An updated scanner.

Type Parameters

T

The class or interface the results of the scan should implement.

IncludeAbstractClasses()

Includes members of abstract classes in the scan.

public ClassScanner IncludeAbstractClasses()

Returns

ClassScanner

An updated scanner.

IncludeAssembly(Assembly)

Includes the specified assembly in the scan.

public ClassScanner IncludeAssembly(Assembly assembly)

Parameters

assembly Assembly

The assembly to include.

Returns

ClassScanner

An updated scanner.

IncludeNonPublicMembers()

Includes non-public members in the scan.

public ClassScanner IncludeNonPublicMembers()

Returns

ClassScanner

An updated scanner.

IncludeReferencedAssemblies()

Includes the referenced assemblies of the previously included assemblies in the scan.

public ClassScanner IncludeReferencedAssemblies()

Returns

ClassScanner

An updated scanner.

IncludeTypes(ReadOnlySpan<Type>)

Includes the specified types in the scan. This can be used to include types from assemblies which are not directly referenced by the loaded assemblies, e.g. plugin assemblies.

public ClassScanner IncludeTypes(ReadOnlySpan<Type> types)

Parameters

types ReadOnlySpan<Type>

The types to include.

Returns

ClassScanner

An updated scanner.

ScanMethods()

Runs the scan for methods.

public IEnumerable<(Type target, MethodInfo method)> ScanMethods()

Returns

IEnumerable<(Type target, MethodInfo method)>

The found methods.

ScanMethods<TAttribute>()

Runs the scan for methods and provides the attribute TAttribute in the results.

public IEnumerable<(Type target, MethodInfo method, TAttribute attribute)> ScanMethods<TAttribute>() where TAttribute : Attribute

Returns

IEnumerable<(Type target, MethodInfo method, TAttribute attribute)>

The found methods with their attribute of type TAttribute.

Type Parameters

TAttribute

The type of the attribute.

ScanTypes()

Runs the scan for methods.

public IEnumerable<Type> ScanTypes()

Returns

IEnumerable<Type>

The found methods.