Namespace:
Nova.CodeDOM
Assembly:
Nova.CodeDOM (in Nova.CodeDOM.dll) Version: 7.44.8391.13415
Syntax public static CodeUnit Load(
string fileName,
LoadOptions loadOptions = LoadOptions.Complete,
Action<LoadStatus, CodeObject> statusCallback = null,
string defaultEncoding = "UTF8"
)
Parameters
- fileName
- Type: SystemString
The source (".cs") file. - loadOptions (Optional)
- Type: Nova.CodeDOMLoadOptions
Determines various optional processing. - statusCallback (Optional)
- Type: SystemActionLoadStatus, CodeObject
Status callback for monitoring progress. - defaultEncoding (Optional)
- Type: SystemString
Default encoding (defaults to "UTF8").
Return Value
Type:
CodeUnitThe resulting CodeUnit object.
Remarks
Loading a code unit directly goes through the following steps:
- Parse the code file.
- Resolve all symbolic references in the code file.
The 'DoNotResolve' option skips resolving symbolic references, which is useful if that step is not required, such as when
only formatting code or calculating metrics which don't rely on resolved references. The 'LoadOnly' option does not apply
in this case, and is ignored if specified.
Note that any external references in the
CodeUnit will fail to resolve, since there is no Project and thus no assembly
or project references. Also, any compiler directive symbols will be undefined. To work around these issues, create a
dummy parent project to hold one or more
CodeUnits before parsing and resolving them.
See Also