//------------------------------------------------------------------------------ // // // Microsoft // Copyright (c) Microsoft Corporation. All rights reserved. // //------------------------------------------------------------------------------ namespace System.CodeDom { using System.Diagnostics; using System; using Microsoft.Win32; using System.Collections; using System.Collections.Specialized; using System.Runtime.Serialization; using System.Runtime.InteropServices; /// /// /// Represents a /// compilation unit declaration. /// /// [ ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable, ] public class CodeCompileUnit: CodeObject { private CodeNamespaceCollection namespaces = new CodeNamespaceCollection(); private StringCollection assemblies = null; private CodeAttributeDeclarationCollection attributes = null; // Optionally Serializable [OptionalField] private CodeDirectiveCollection startDirectives = null; [OptionalField] private CodeDirectiveCollection endDirectives = null; /// /// /// Initializes a new instance of . /// /// public CodeCompileUnit() { } /// /// /// Gets or sets the collection of namespaces. /// /// public CodeNamespaceCollection Namespaces { get { return namespaces; } } /// /// /// Gets the collection of assemblies. Most code generators will not need this, but the Managed /// extensions for C++ code generator and /// other very low level code generators will need to do a more complete compilation. If both this /// and the compiler assemblies are specified, the compiler assemblies should win. /// /// public StringCollection ReferencedAssemblies { get { if (assemblies == null) { assemblies = new StringCollection(); } return assemblies; } } /// /// /// Gets the collection of assembly level attributes. /// /// public CodeAttributeDeclarationCollection AssemblyCustomAttributes { get { if (attributes == null) { attributes = new CodeAttributeDeclarationCollection(); } return attributes; } } public CodeDirectiveCollection StartDirectives { get { if (startDirectives == null) { startDirectives = new CodeDirectiveCollection(); } return startDirectives; } } public CodeDirectiveCollection EndDirectives { get { if (endDirectives == null) { endDirectives = new CodeDirectiveCollection(); } return endDirectives ; } } } }