The Labs \ Source Viewer \ SSCLI \ System.CodeDom \ CodeCompileUnit

  1. //------------------------------------------------------------------------------
  2. // <copyright file="CodeCompileUnit.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.CodeDom
  16. {
  17.    
  18.     using System.Diagnostics;
  19.     using System;
  20.     using Microsoft.Win32;
  21.     using System.Collections;
  22.     using System.Collections.Specialized;
  23.     using System.Runtime.Serialization;
  24.     using System.Runtime.InteropServices;
  25.    
  26.     /// <devdoc>
  27.     /// <para>
  28.     /// Represents a
  29.     /// compilation unit declaration.
  30.     /// </para>
  31.     /// </devdoc>
  32.     [ClassInterface(ClassInterfaceType.AutoDispatch), ComVisible(true), Serializable()]
  33.     public class CodeCompileUnit : CodeObject
  34.     {
  35.         private CodeNamespaceCollection namespaces = new CodeNamespaceCollection();
  36.         private StringCollection assemblies = null;
  37.         private CodeAttributeDeclarationCollection attributes = null;
  38.        
  39.         // Optionally Serializable
  40.         [OptionalField()]
  41.         private CodeDirectiveCollection startDirectives = null;
  42.         [OptionalField()]
  43.         private CodeDirectiveCollection endDirectives = null;
  44.        
  45.         /// <devdoc>
  46.         /// <para>
  47.         /// Initializes a new instance of <see cref='System.CodeDom.CodeCompileUnit'/>.
  48.         /// </para>
  49.         /// </devdoc>
  50.         public CodeCompileUnit()
  51.         {
  52.         }
  53.        
  54.         /// <devdoc>
  55.         /// <para>
  56.         /// Gets or sets the collection of namespaces.
  57.         /// </para>
  58.         /// </devdoc>
  59.         public CodeNamespaceCollection Namespaces {
  60.             get { return namespaces; }
  61.         }
  62.        
  63.         /// <devdoc>
  64.         /// <para>
  65.         /// Gets the collection of assemblies. Most code generators will not need this, but the Managed
  66.         /// extensions for C++ code generator and
  67.         /// other very low level code generators will need to do a more complete compilation. If both this
  68.         /// and the compiler assemblies are specified, the compiler assemblies should win.
  69.         /// </para>
  70.         /// </devdoc>
  71.         public StringCollection ReferencedAssemblies {
  72.             get {
  73.                 if (assemblies == null) {
  74.                     assemblies = new StringCollection();
  75.                 }
  76.                 return assemblies;
  77.             }
  78.         }
  79.        
  80.         /// <devdoc>
  81.         /// <para>
  82.         /// Gets the collection of assembly level attributes.
  83.         /// </para>
  84.         /// </devdoc>
  85.         public CodeAttributeDeclarationCollection AssemblyCustomAttributes {
  86.             get {
  87.                 if (attributes == null) {
  88.                     attributes = new CodeAttributeDeclarationCollection();
  89.                 }
  90.                 return attributes;
  91.             }
  92.         }
  93.        
  94.         public CodeDirectiveCollection StartDirectives {
  95.             get {
  96.                 if (startDirectives == null) {
  97.                     startDirectives = new CodeDirectiveCollection();
  98.                 }
  99.                 return startDirectives;
  100.             }
  101.         }
  102.        
  103.         public CodeDirectiveCollection EndDirectives {
  104.             get {
  105.                 if (endDirectives == null) {
  106.                     endDirectives = new CodeDirectiveCollection();
  107.                 }
  108.                 return endDirectives;
  109.             }
  110.         }
  111.     }
  112. }

Developer Fusion