Table of Contents

Class ConnectorHelpers

Namespace
Steeltoe.CloudFoundry.Connector
Assembly
Steeltoe.CloudFoundry.ConnectorBase.dll
public static class ConnectorHelpers
Inheritance
ConnectorHelpers
Inherited Members

Methods

CreateInstance(Type, object[])

Create an instance of a type

public static object CreateInstance(Type t, object[] args = null)

Parameters

t Type

Type to instantiate

args object[]

Constructor parameters

Returns

object

New instance of desired type

FindAssembly(string)

Find an assembly

public static Assembly FindAssembly(string name)

Parameters

name string

Name of the assembly to find

Returns

Assembly

A representation of the assembly

FindMethod(Type, string, Type[])

Find a method within a type

public static MethodInfo FindMethod(Type type, string methodName, Type[] parameters = null)

Parameters

type Type

The type to search

methodName string

The name of the method

parameters Type[]

(Optional) The parameters in the signature

Returns

MethodInfo

The method you're searching for

FindType(Assembly, string)

Find a type from within an assembly

public static Type FindType(Assembly assembly, string typeName)

Parameters

assembly Assembly

The assembly to search

typeName string

The name of the type to retrieve

Returns

Type

The type

FindType(string[], string[])

Search a list of assemblies for the first matching type

public static Type FindType(string[] assemblyNames, string[] typeNames)

Parameters

assemblyNames string[]

List of assembly names to search

typeNames string[]

List of suitable types

Returns

Type

An appropriate type

Remarks

Great for finding an implementation type that could have one or more names in one or more assemblies

FindTypeOrThrow(string[], string[], string, string)

Search a list of assemblies for the first matching type

public static Type FindTypeOrThrow(string[] assemblyNames, string[] typeNames, string typeName, string assemblyShortDescription)

Parameters

assemblyNames string[]

List of assembly names to search

typeNames string[]

List of suitable types

typeName string

To use in exception

assemblyShortDescription string

Describe what might be missing

Returns

Type

An appropriate type

Remarks

Great for finding an implementation type that could have one or more names in one or more assemblies

Exceptions

ConnectorException

When type isn't found

Invoke(MethodBase, object, object[])

Invoke a function

public static object Invoke(MethodBase member, object instance, object[] args)

Parameters

member MethodBase

The method to execute

instance object

Instance of an object, if required by the method

args object[]

Arguments to pass to the method

Returns

object

Results of method call

TrySetProperty(object, string, object)

Try to set a property on an object

public static void TrySetProperty(object obj, string property, object value)

Parameters

obj object

Object to set a value on

property string

Property to set

value object

Value to use