Click or drag to resize

CodeUnitLoadFragment Method

Load a fragment of code from the specified string.

Namespace:  Nova.CodeDOM
Assembly:  Nova.CodeDOM (in Nova.CodeDOM.dll) Version: 7.44.8391.13415
Syntax
C#
public static CodeUnit LoadFragment(
	string codeFragment,
	string name = null,
	LoadOptions loadOptions = LoadOptions.Complete,
	Project project = null,
	string defaultEncoding = "UTF8"
)

Parameters

codeFragment
Type: SystemString
A fragment of code as a string.
name (Optional)
Type: SystemString
An optional name for the code fragment.
loadOptions (Optional)
Type: Nova.CodeDOMLoadOptions
Determines various optional processing.
project (Optional)
Type: Nova.CodeDOMProject
A parent project, if any (for resolving external references).
defaultEncoding (Optional)
Type: SystemString
Default encoding (defaults to "UTF8").

Return Value

Type: CodeUnit
The resulting CodeUnit object.
Remarks
The code fragment is parsed, and optionally resolved. Note that any external references in the code fragment will fail to resolve if no parent Project is supplied, since there wll be no assembly or project references (also, any compiler directive symbols will be undefined). To work around such an issue, pass in an existing parent project or newly created dummy parent project that has the required assembly references.
See Also