CodeObject Class
Base class for all code objects in the CodeDOM tree.
public abstract class CodeObjectExample
var unit = new CompilationUnit();
var ns = unit.AddNamespace("MyNamespace");
var cls = ns.AddType(new ClassDeclaration("MyClass"));
// Code objects form a tree
Assert.Same(ns, cls.Parent);
Assert.Same(unit, ns.Parent);Constructors
| Name | Description |
|---|---|
| CodeObject() |
CodeObject()
CodeObject.csprotected CodeObject()No documentation is available.
Properties
| Name | Description |
|---|---|
| Data | Gets a dictionary for storing custom data associated with this code object. |
| Parent | Gets or sets the parent code object in the CodeDOM tree. |
Data
CodeObject.csGets a dictionary for storing custom data associated with this code object.
public IDictionary<string, object?> Data { get; }Property value
Parent
CodeObject.csGets or sets the parent code object in the CodeDOM tree.
public CodeObject? Parent { get; }Property value
Methods
| Name | Description |
|---|---|
| SetData(string, object?) | Sets custom data on this code object. |
| SetParent<T>(CodeObject, T?) | |
| SetParent<T>(CodeObject, T?, T?) | |
| SetParent<T>(T?) | |
| SetParent<T>(T?, T?) | |
| ToCsharpString() | Converts this code object to C# code. |
| ToString() |
SetData(string, object?)
CodeObject.csSetParent overloads
SetParent<T>(CodeObject, T?)
CodeObject.csprotected static T SetParent<T>(CodeObject parent, T? value) where T : CodeObjectNo documentation is available.
SetParent<T>(CodeObject, T?, T?)
CodeObject.csprotected static void SetParent<T>(CodeObject parent, ref T? field, T? value) where T : CodeObjectNo documentation is available.
SetParent<T>(T?)
CodeObject.csprotected T SetParent<T>(T? value) where T : CodeObjectType parameters
T
Parameters
valueT?
Returns
T
No documentation is available.
SetParent<T>(T?, T?)
CodeObject.csprotected void SetParent<T>(ref T? field, T? value) where T : CodeObjectType parameters
T
Parameters
fieldT?valueT?
No documentation is available.