Show / Hide Table of Contents

Class GeneralExtensions

General extensions for common cases

Inheritance
System.Object
GeneralExtensions
Namespace: Harmony
Assembly: 0Harmony.dll
Syntax
public static class GeneralExtensions : object

Methods

| Improve this Doc View Source

Description(Type[])

Converts an array of types (for example methods arguments) into a human readable form

Declaration
public static string Description(this Type[] parameters)
Parameters
Type Name Description
Type[] parameters

The array of types

Returns
Type Description
System.String

A human readable description including brackets

| Improve this Doc View Source

FullDescription(MethodBase)

A a full description of a method or a constructor without assembly details but with generics

Declaration
public static string FullDescription(this MethodBase method)
Parameters
Type Name Description
MethodBase method

The method or constructor

Returns
Type Description
System.String

A human readable description

| Improve this Doc View Source

FullDescription(Type)

A full description of a type

Declaration
public static string FullDescription(this Type type)
Parameters
Type Name Description
Type type

The type

Returns
Type Description
System.String

A human readable description

| Improve this Doc View Source

GetTypedValue<T>(Dictionary<String, Object>, String)

A helper to access a value via key from a dictionary with extra casting

Declaration
public static T GetTypedValue<T>(this Dictionary<string, object> dictionary, string key)
Parameters
Type Name Description
Dictionary<System.String, System.Object> dictionary

The dictionary

System.String key

The key

Returns
Type Description
T

The value for the key or the default value (of T) if that key does not exist or cannot be cast to T

Type Parameters
Name Description
T

The value type

| Improve this Doc View Source

GetValueSafe<S, T>(Dictionary<S, T>, S)

A helper to access a value via key from a dictionary

Declaration
public static T GetValueSafe<S, T>(this Dictionary<S, T> dictionary, S key)
Parameters
Type Name Description
Dictionary<S, T> dictionary

The dictionary

S key

The key

Returns
Type Description
T

The value for the key or the default value (of T) if that key does not exist

Type Parameters
Name Description
S

The key type

T

The value type

| Improve this Doc View Source

Join<T>(IEnumerable<T>, Func<T, String>, String)

Joins an enumeration with a value converter and a delimiter to a string

Declaration
public static string Join<T>(this IEnumerable<T> enumeration, Func<T, string> converter = null, string delimiter = ", ")
Parameters
Type Name Description
IEnumerable<T> enumeration

The enumeration

Func<T, System.String> converter

An optional value converter (from T to string)

System.String delimiter

An optional delimiter

Returns
Type Description
System.String

The values joined into a string

Type Parameters
Name Description
T

The inner type of the enumeration

| Improve this Doc View Source

Types(ParameterInfo[])

A helper converting parameter infos to types

Declaration
public static Type[] Types(this ParameterInfo[] pinfo)
Parameters
Type Name Description
ParameterInfo[] pinfo

The array of ParameterInfo

Returns
Type Description
Type[]

The parameter types

  • Improve this Doc
  • View Source
Back to top Generated by DocFX