![]() | RoslynEvaluator Class |
Namespace: CSScriptLib
public class RoslynEvaluator : IEvaluator
The RoslynEvaluator type exposes the following members.
Name | Description | |
---|---|---|
![]() | RoslynEvaluator |
Initializes a new instance of the RoslynEvaluator class.
|
Name | Description | |
---|---|---|
![]() | CompilerSettings |
Gets or sets the compiler settings.
|
![]() | DebugBuild |
Gets or sets a value indicating whether to compile script with debug symbols.
Note, setting DebugBuild will only affect the current instance of Evaluator. If you want to emit debug symbols for all instances of Evaluator then use EvaluatorConfig.DebugBuild. |
![]() | DisableReferencingFromCode |
Gets or sets the flag indicating if the script code should be analyzed and the assemblies
that the script depend on (via '//css_...' and 'using ...' directives) should be referenced.
|
Name | Description | |
---|---|---|
![]() ![]() | Check |
Compiles the specified script text without loading it into the AppDomain or
writing to the file system.
|
![]() | Clone |
Clones itself as IEvaluator.
This method returns a freshly initialized copy of the IEvaluator. The cloning 'depth' can be controlled by the copyRefAssemblies. This method is a convenient technique when multiple IEvaluator instances are required (e.g. for concurrent script evaluation). |
![]() ![]() | CompileAssemblyFromCode |
Compiles C# code (script) into assembly file. The C# code is a typical C# code containing a single or multiple class definition(s).
|
![]() ![]() | CompileAssemblyFromFile |
Compiles C# file (script) into assembly file. The C# contains typical C# code containing a single or multiple class definition(s).
|
![]() ![]() | CompileCode(String) |
Evaluates (compiles) C# code (script). The C# code is a typical C# code containing a single or multiple class definition(s).
|
![]() ![]() | CompileCode(String, CompileInfo) |
Evaluates (compiles) C# code (script). The C# code is a typical C# code containing a single or multiple class definition(s).
The method is identical to CompileCode(String) except that it allows specifying the destination assembly file. |
![]() ![]() | CompileMethod |
Wraps C# code fragment into auto-generated class (type name DynamicClass) and evaluates it.
This method is a logical equivalent of CompileCode(String, CompileInfo) but is allows you to define your script class by specifying class method instead of whole class declaration. |
![]() ![]() | CreateDelegate(String) |
Wraps C# code fragment into auto-generated class (type name DynamicClass), evaluates it and loads the class to the current AppDomain.
Returns non-typed MethodDelegate for class-less style of invoking. |
![]() ![]() | CreateDelegateT(String) |
Wraps C# code fragment into auto-generated class (type name DynamicClass), evaluates it and loads the class to the current AppDomain.
Returns typed MethodDelegateT for class-less style of invoking. |
![]() | Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as the default hash function. (Inherited from Object.) |
![]() | GetReferencedAssemblies |
Returns set of referenced assemblies.
Notre: the set of assemblies is cleared on Reset. |
![]() | GetReferencedAssemblies(String, String) |
Analyses the script code and returns set of locations for the assemblies referenced from the code with CS-Script directives (//css_ref).
|
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() ![]() | LoadCode(String, Object) |
Evaluates and loads C# code to the current AppDomain. Returns instance of the first class defined in the code.
|
![]() ![]() | LoadCodeT(String, Object) |
Evaluates and loads C# code to the current AppDomain. Returns instance of the first class defined in the code.
|
![]() ![]() | LoadCompilers |
Loads the assemblies implementing Roslyn compilers.
Roslyn compilers are extremely heavy and loading the compiler assemblies for with the first evaluation call can take a significant time to complete (in some cases up to 4 seconds) while the consequent calls are very fast. You may want to call this method to pre-load the compiler assembly your script evaluation performance. |
![]() ![]() | LoadDelegateT |
Wraps C# code fragment into auto-generated class (type name DynamicClass), evaluates it and loads
the class to the current AppDomain.
Returns instance of T delegate for the first method in the auto-generated class. |
![]() ![]() | LoadFile(String, Object) |
Evaluates and loads C# code from the specified file to the current AppDomain. Returns instance of the first
class defined in the script file.
|
![]() ![]() | LoadFileT(String, Object) |
Evaluates and loads C# code from the specified file to the current AppDomain. Returns instance of the first
class defined in the script file.
After initializing the class instance it is aligned to the interface specified by the parameter T.
Note: the script class does not have to inherit from the T parameter as the proxy type will be generated anyway. |
![]() ![]() | LoadMethod(String) |
Wraps C# code fragment into auto-generated class (type name DynamicClass), evaluates it and loads
the class to the current AppDomain.
|
![]() ![]() | LoadMethodT(String) |
Wraps C# code fragment into auto-generated class (type name DynamicClass), evaluates it and loads
the class to the current AppDomain.
After initializing the class instance it is aligned to the interface specified by the parameter T. |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ReferenceAssembliesFromCode |
References the assemblies from the script code.
The method analyses and tries to resolve CS-Script directives (e.g. '//css_ref') and 'used' namespaces based on the optional search directories. |
![]() | ReferenceAssembly(Assembly) |
References the given assembly.
It is safe to call this method multiple times for the same assembly. If the assembly already referenced it will not be referenced again. |
![]() | ReferenceAssembly(String) |
References the given assembly by the assembly path.
It is safe to call this method multiple times for the same assembly. If the assembly already referenced it will not be referenced again. |
![]() | ReferenceAssemblyByName |
References the name of the assembly by its partial name.
Note that the referenced assembly will be loaded into the host AppDomain in order to resolve assembly partial name. It is an equivalent of Evaluator.ReferenceAssembly(Assembly.Load(assemblyPartialName)) |
![]() | ReferenceAssemblyByNamespace |
References the assembly by the given namespace it implements.
Adds assembly reference if the namespace was successfully resolved (found) and, otherwise does nothing |
![]() | ReferenceAssemblyOf(Object) |
References the assembly by the object, which belongs to this assembly.
It is safe to call this method multiple times for the same assembly. If the assembly already referenced it will not be referenced again. |
![]() | ReferenceAssemblyOfT |
References the assembly by the object, which belongs to this assembly.
It is safe to call this method multiple times for the same assembly. If the assembly already referenced it will not be referenced again. |
![]() | ReferenceDomainAssemblies |
References the assemblies the are already loaded into the current AppDomain.
|
![]() | Reset |
Resets Evaluator.
Resetting means clearing all referenced assemblies, recreating evaluation infrastructure (e.g. compiler setting) and reconnection to or recreation of the underlying compiling services. Optionally the default current AppDomain assemblies can be referenced automatically with referenceDomainAssemblies. |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
![]() | TryReferenceAssemblyByNamespace |
References the assembly by the given namespace it implements.
|