<?xml version="1.0" encoding="utf-8"?> <Type Name="CodeNamespace" FullName="System.CodeDom.CodeNamespace"> <TypeSignature Language="C#" Value="public class CodeNamespace : System.CodeDom.CodeObject" Maintainer="auto" /> <TypeSignature Language="ILAsm" Value=".class public auto ansi serializable beforefieldinit CodeNamespace extends System.CodeDom.CodeObject" /> <AssemblyInfo> <AssemblyName>System</AssemblyName> <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00]</AssemblyPublicKey> <AssemblyVersion>1.0.3300.0</AssemblyVersion> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> <AssemblyVersion>4.0.0.0</AssemblyVersion> </AssemblyInfo> <ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement> <Base> <BaseTypeName>System.CodeDom.CodeObject</BaseTypeName> </Base> <Interfaces /> <Attributes> <Attribute> <AttributeName>System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.AutoDispatch)</AttributeName> </Attribute> <Attribute> <AttributeName>System.Runtime.InteropServices.ComVisible(true)</AttributeName> </Attribute> </Attributes> <Docs> <remarks> <attribution license="cc4" from="Microsoft" modified="false" /> <para> <see cref="T:System.CodeDom.CodeNamespace" /> can be used to represent a namespace declaration.</para> <para>The <see cref="P:System.CodeDom.CodeNamespace.Name" /> property specifies the name of the namespace. The <see cref="P:System.CodeDom.CodeNamespace.Imports" /> property contains the namespace import directives for the namespace. The <see cref="P:System.CodeDom.CodeNamespace.Types" /> property contains the type declarations for the namespace. The <see cref="P:System.CodeDom.CodeNamespace.Comments" /> property contains the comments that apply at the namespace level.</para> <para>In some languages, a namespace can function as a container for type declarations; all types in the same namespace are accessible without using fully-qualified type references, if the there is no conflict between type names.</para> <block subset="none" type="note"> <para>Use fully qualified type references to avoid potential ambiguity.</para> </block> </remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Represents a namespace declaration.</para> </summary> </Docs> <Members> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public CodeNamespace ();" /> <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> <AssemblyVersion>4.0.0.0</AssemblyVersion> </AssemblyInfo> <ReturnValue /> <Parameters /> <Docs> <remarks>After the object has be constructed, the <see cref="M:System.CodeDom.CodeNamespace.Name" /> property has to be set before the Code Generator is called on it.</remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Initializes a new instance of the <see cref="T:System.CodeDom.CodeNamespace" /> class.</para> </summary> </Docs> </Member> <Member MemberName=".ctor"> <MemberSignature Language="C#" Value="public CodeNamespace (string name);" /> <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string name) cil managed" /> <MemberType>Constructor</MemberType> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> <AssemblyVersion>4.0.0.0</AssemblyVersion> </AssemblyInfo> <ReturnValue /> <Parameters> <Parameter Name="name" Type="System.String" /> </Parameters> <Docs> <remarks> <code lang="C#"> using System; using System.Text; using System.IO; using System.CodeDom; using System.CodeDom.Compiler; using Microsoft.CSharp; /* Outputs an empty namespace called Mono.CodeDomDemo in c# * namespace Mono.CodeDomDemo { * * } */ class CodeDomDemo { public static int Main(string[] args) { // Create namespace CodeNamespace demoNs= new CodeNamespace("Mono.CodeDomDemo"); // Generate c# code CSharpCodeProvider provider = new CSharpCodeProvider(); ICodeGenerator codeGen = provider.CreateGenerator (); StringWriter sw = new StringWriter(new StringBuilder()); codeGen.GenerateCodeFromNamespace(demoNs, sw,new CodeGeneratorOptions()); Console.WriteLine(sw.ToString()); return(0); } } </code> </remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Initializes a new instance of the <see cref="T:System.CodeDom.CodeNamespace" /> class using the specified name.</para> </summary> <param name="name"> <attribution license="cc4" from="Microsoft" modified="false" />The name of the namespace being declared. </param> </Docs> </Member> <Member MemberName="Comments"> <MemberSignature Language="C#" Value="public System.CodeDom.CodeCommentStatementCollection Comments { get; }" /> <MemberSignature Language="ILAsm" Value=".property instance class System.CodeDom.CodeCommentStatementCollection Comments" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> <AssemblyVersion>4.0.0.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.CodeDom.CodeCommentStatementCollection</ReturnType> </ReturnValue> <Docs> <value> <see cref="T:System.CodeDom.CodeCommentStatementCollection" /> object, which is a collection of comments on the namespace.</value> <remarks> <code lang="C#"> /* Creates namespace like thus when c# code is generated. /* // Demo Namespace /* namespace Mono.CodeDomDemo { /* /* } ... CodeNamespace demoNs= new CodeNamespace("Mono.CodeDomDemo"); demoNs.Comments.Add(new CodeCommentStatement("Demo Namespace")); ... </code> </remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Gets the comments for the namespace.</para> </summary> </Docs> </Member> <Member MemberName="Imports"> <MemberSignature Language="C#" Value="public System.CodeDom.CodeNamespaceImportCollection Imports { get; }" /> <MemberSignature Language="ILAsm" Value=".property instance class System.CodeDom.CodeNamespaceImportCollection Imports" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> <AssemblyVersion>4.0.0.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.CodeDom.CodeNamespaceImportCollection</ReturnType> </ReturnValue> <Docs> <value> <see cref="T:System.CodeDom.CodeNamespaceImportCollection" /> object, which is a collection of imports applicable to the namespace.</value> <remarks> <code lang="C#"> /* Creates namespace like thus when c# code is generated. /* namespace Mono.CodeDomDemo { /* using System.Data; /* } ... CodeNamespace demoNs= new CodeNamespace("Mono.CodeDomDemo"); demoNs.Imports.Add(new CodeNamespaceImport("System.Data")); ... </code> </remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Gets the collection of namespace import directives used by the namespace.</para> </summary> </Docs> </Member> <Member MemberName="Name"> <MemberSignature Language="C#" Value="public string Name { get; set; }" /> <MemberSignature Language="ILAsm" Value=".property instance string Name" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> <AssemblyVersion>4.0.0.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.String</ReturnType> </ReturnValue> <Parameters> </Parameters> <Docs> <value>Name of the generated Namespace.</value> <remarks>To be added</remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Gets or sets the name of the namespace.</para> </summary> </Docs> </Member> <Member MemberName="PopulateComments"> <MemberSignature Language="C#" Value="public event EventHandler PopulateComments;" /> <MemberSignature Language="ILAsm" Value=".event class System.EventHandler PopulateComments" /> <MemberType>Event</MemberType> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> <AssemblyVersion>4.0.0.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.EventHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <remarks>To be added</remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>An event that will be raised the first time the <see cref="P:System.CodeDom.CodeNamespace.Comments" /> collection is accessed.</para> </summary> </Docs> </Member> <Member MemberName="PopulateImports"> <MemberSignature Language="C#" Value="public event EventHandler PopulateImports;" /> <MemberSignature Language="ILAsm" Value=".event class System.EventHandler PopulateImports" /> <MemberType>Event</MemberType> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> <AssemblyVersion>4.0.0.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.EventHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <remarks>To be added</remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>An event that will be raised the first time the <see cref="P:System.CodeDom.CodeNamespace.Imports" /> collection is accessed.</para> </summary> </Docs> </Member> <Member MemberName="PopulateTypes"> <MemberSignature Language="C#" Value="public event EventHandler PopulateTypes;" /> <MemberSignature Language="ILAsm" Value=".event class System.EventHandler PopulateTypes" /> <MemberType>Event</MemberType> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> <AssemblyVersion>4.0.0.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.EventHandler</ReturnType> </ReturnValue> <Parameters /> <Docs> <remarks>To be added</remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>An event that will be raised the first time the <see cref="P:System.CodeDom.CodeNamespace.Types" /> collection is accessed.</para> </summary> </Docs> </Member> <Member MemberName="Types"> <MemberSignature Language="C#" Value="public System.CodeDom.CodeTypeDeclarationCollection Types { get; }" /> <MemberSignature Language="ILAsm" Value=".property instance class System.CodeDom.CodeTypeDeclarationCollection Types" /> <MemberType>Property</MemberType> <AssemblyInfo> <AssemblyVersion>1.0.5000.0</AssemblyVersion> <AssemblyVersion>2.0.0.0</AssemblyVersion> <AssemblyVersion>4.0.0.0</AssemblyVersion> </AssemblyInfo> <ReturnValue> <ReturnType>System.CodeDom.CodeTypeDeclarationCollection</ReturnType> </ReturnValue> <Docs> <value>To be added: an object of type 'CodeTypeDeclarationCollection'</value> <remarks>This is a collection of <see cref="T:System.CodeDom.CodeTypeDeclaration" />s that reside inside the Namespace. <example><code lang="C#"> // This example creates a Mono.CodeDomDemo namespace and adds a new class 'Hello' to it. ... // Create Hello class CodeTypeDeclaration helloClass=new CodeTypeDeclaration("Hello"); helloClass.IsClass=true; ... CodeNamespace testNs= new CodeNamespace("Mono.CodeDomDemo"); testNs.Types.Add(helloClass); </code></example></remarks> <summary> <attribution license="cc4" from="Microsoft" modified="false" /> <para>Gets the collection of types that the namespace contains.</para> </summary> </Docs> </Member> </Members> </Type>