CodeCompileUnit Class
Provides a container for a CodeDOM program graph.
Assembly: System (in System.dll)
System.CodeDom.CodeObject
System.CodeDom.CodeCompileUnit
System.CodeDom.CodeSnippetCompileUnit
| Name | Description | |
|---|---|---|
![]() | CodeCompileUnit() | Initializes a new instance of the CodeCompileUnit class. |
| Name | Description | |
|---|---|---|
![]() | AssemblyCustomAttributes | Gets a collection of custom attributes for the generated assembly. |
![]() | EndDirectives | Gets a CodeDirectiveCollection object containing end directives. |
![]() | Namespaces | Gets the collection of namespaces. |
![]() | ReferencedAssemblies | Gets the referenced assemblies. |
![]() | StartDirectives | Gets a CodeDirectiveCollection object containing start directives. |
![]() | UserData | Gets the user-definable data for the current object.(Inherited from CodeObject.) |
| Name | Description | |
|---|---|---|
![]() | Equals(Object) | 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.) |
![]() | GetType() | |
![]() | MemberwiseClone() | |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
CodeCompileUnit provides a container for a CodeDOM program graph.
CodeCompileUnit contains a collection that can store CodeNamespace objects containing CodeDOM source code graphs, along with a collection of assemblies referenced by the project, and a collection of attributes for the project assembly.
A CodeCompileUnit can be passed to the GenerateCodeFromCompileUnit method of an ICodeGenerator implementation along with other parameters to generate code based on the program graph contained by the compile unit.
Note |
|---|
Some languages support only a single namespace that contains a single class in a compile unit. |
The following code example constructs a CodeCompileUnit that models the program structure of a simple "Hello World" program. This code example is part of a larger example that also produces code from this model, and is provided for the CodeDomProvider class.
Available since 1.1
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.



