Open sandboxFocus

Method CreateCompilation

CreateCompilation(string, string?, bool, IEnumerable<MetadataReference>?, string?, bool)

Creates an ICompilation made of a single source file.

Declaration
public ICompilation CreateCompilation(string code, string? dependentCode = null, bool ignoreErrors = false, IEnumerable<MetadataReference>? additionalReferences = null, string? name = null, bool addMetalamaReferences = true)
Parameters
Type Name Description
string code

Source code.

string dependentCode

Source code of another assembly added as a reference to the returned assembly. Optional.

bool ignoreErrors

Determines whether compilation errors should be ignored. Optional.

IEnumerable<MetadataReference> additionalReferences

Additional set of MetadataReference added to the compilation.

string name

Name of the assembly.

bool addMetalamaReferences

Determines if Metalama assemblies should be added as references to the compilation. Optional. The default value is true.

Returns
Type Description
ICompilation

CreateCompilation(IReadOnlyDictionary<string, string>, string?, bool, IEnumerable<MetadataReference>?, string?, bool)

Creates an ICompilation made of several source files.

Declaration
public ICompilation CreateCompilation(IReadOnlyDictionary<string, string> code, string? dependentCode = null, bool ignoreErrors = false, IEnumerable<MetadataReference>? additionalReferences = null, string? name = null, bool addMetalamaReferences = true)
Parameters
Type Name Description
IReadOnlyDictionary<string, string> code

Source code. The key of the dictionary item is the file name, the value is the source code.

string dependentCode

Source code of another assembly added as a reference to the returned assembly. Optional.

bool ignoreErrors

Determines whether compilation errors should be ignored. Optional.

IEnumerable<MetadataReference> additionalReferences

Additional set of MetadataReference added to the compilation.

string name

Name of the assembly.

bool addMetalamaReferences

Determines if Metalama assemblies should be added as references to the compilation. Optional. The default value is true.

Returns
Type Description
ICompilation

CreateCompilation(Compilation)

Creates an ICompilation from a Compilation.

Declaration
public ICompilation CreateCompilation(Compilation compilation)
Parameters
Type Name Description
Compilation compilation
Returns
Type Description
ICompilation