C# Class Gearset.ReflectionHelper

Show file Open project: juancampa/Gearset

Public Properties

Property Type Description
CodeProvider CodeDomProvider
CompilerParameters System.CodeDom.Compiler.CompilerParameters

Public Methods

Method Description
AddReferencedAssembly ( String assemblyFullName ) : void
AddUsingNamespace ( String name ) : void
ClearReferencedAsseblies ( ) : void
ClearUsings ( ) : void
CompileCSharpMethod ( String code, Type returnType ) : MethodInfo

Creates a C# Method that can be called from the specified code

CompileCSharpMethodBatch ( IEnumerable codes, IEnumerable returnTypes ) : List

This method is not intended as a generic way to compile CSHARP code, it is highly coupled with the InspectorManager.

RunCSharpLine ( String line ) : void

Compiles and run the passed C# Code without returning results. Parameters can be accesed using the notation "(type)p[i]" where type is the Type of the passed parameter in the i direction. We tryied to make this method with a generic parameter so it wouldn't generate garbage when dealing with Value Types, but the Invoke method will return an Object and garbage would have been still generated.

RunCSharpLineAndReturnValue ( String line ) : Object

Compiles and run the passed C# Code. Returns the value of the line.

Private Methods

Method Description
ReflectionHelper ( ) : System

Method Details

AddReferencedAssembly() public static method

public static AddReferencedAssembly ( String assemblyFullName ) : void
assemblyFullName String
return void

AddUsingNamespace() public static method

public static AddUsingNamespace ( String name ) : void
name String
return void

ClearReferencedAsseblies() public static method

public static ClearReferencedAsseblies ( ) : void
return void

ClearUsings() public static method

public static ClearUsings ( ) : void
return void

CompileCSharpMethod() public static method

Creates a C# Method that can be called from the specified code
public static CompileCSharpMethod ( String code, Type returnType ) : MethodInfo
code String
returnType System.Type Set it to null if the method should return void.
return System.Reflection.MethodInfo

CompileCSharpMethodBatch() public static method

This method is not intended as a generic way to compile CSHARP code, it is highly coupled with the InspectorManager.
public static CompileCSharpMethodBatch ( IEnumerable codes, IEnumerable returnTypes ) : List
codes IEnumerable
returnTypes IEnumerable
return List

RunCSharpLine() public static method

Compiles and run the passed C# Code without returning results. Parameters can be accesed using the notation "(type)p[i]" where type is the Type of the passed parameter in the i direction. We tryied to make this method with a generic parameter so it wouldn't generate garbage when dealing with Value Types, but the Invoke method will return an Object and garbage would have been still generated.
public static RunCSharpLine ( String line ) : void
line String
return void

RunCSharpLineAndReturnValue() public static method

Compiles and run the passed C# Code. Returns the value of the line.
public static RunCSharpLineAndReturnValue ( String line ) : Object
line String
return Object

Property Details

CodeProvider public static property

The provider used to compile C# Code.
public static CodeDomProvider CodeProvider
return CodeDomProvider

CompilerParameters public static property

The parameters to be passed to the compiler.
public static CompilerParameters,System.CodeDom.Compiler CompilerParameters
return System.CodeDom.Compiler.CompilerParameters