青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

C++ Programmer's Cookbook

{C++ 基礎(chǔ)} {C++ 高級(jí)} {C#界面,C++核心算法} {設(shè)計(jì)模式} {C#基礎(chǔ)}

使用codeDom ---namespace 動(dòng)態(tài)的生成.net代碼

using ?System;
using ?System.CodeDom;
using ?System.CodeDom.Compiler;
using ?System.Reflection;
using ?System.IO;
using ?Microsoft.CSharp;
using ?Microsoft.VisualBasic;

namespace ?CodeDomPartOne
{
????
/// ?
????
/// ?Summary?description?for?Briefcase.
????
/// ?

???? public ? class ?Briefcase
????
{
????????
// Member?Variables????????
???????? private ? string ?m_strFileName;
????????
private ? string ?m_Suffix? = ? " .cs " ;

????????
public ?Briefcase( string ?strFileName)
????????
{
????????????m_strFileName?
= ?strFileName;
????????}

????????
public ? static ? void ?Main()
????????
{
????????????Briefcase?dd?
= ? new ?Briefcase( " my " );
????????????dd.CreateCodeDomBriefcase();
????????}

????????
public ? void ?CreateCodeDomBriefcase()
????????
{
????????????
// Initialize?CodeDom?Variables????????????
????????????Stream?s? = ?File.Open( " c:\\ " ? + ?m_strFileName? + ?m_Suffix,?FileMode.Create);
????????????StreamWriter?sw?
= ? new ?StreamWriter(s);

????????????CSharpCodeProvider?cscProvider?
= ? new ?CSharpCodeProvider();
????????????ICodeGenerator?cscg?
= ?cscProvider.CreateGenerator(sw);
????????????CodeGeneratorOptions?cop?
= ? new ?CodeGeneratorOptions();

????????????
// Create?Class?Using?Statements
????????????CodeSnippetCompileUnit?csu1? = ? new ?CodeSnippetCompileUnit( " using?System " );
????????????CodeSnippetCompileUnit?csu2?
= ? new ?CodeSnippetCompileUnit( " using?System.IO " );
????????????cscg.GenerateCodeFromCompileUnit(csu1,?sw,?cop);
????????????cscg.GenerateCodeFromCompileUnit(csu2,?sw,?cop);
????????????sw.WriteLine();

????????????
// Create?Class?Namespaces
????????????CodeNamespace?cnsCodeDom? = ? new ?CodeNamespace( " CodeDom " );
????????????
????????????
// Create?Class?Declaration
????????????CodeTypeDeclaration?ctd? = ? new ?CodeTypeDeclaration();
????????????ctd.IsClass?
= ? true ;
????????????ctd.Name?
= ? " Briefcase " ;
????????????ctd.TypeAttributes?
= ?TypeAttributes.Public;

????????????
// Create?Class?Member?Fields????
????????????sw.WriteLine();
????????????CodeMemberField?cmfBriefcaseName?
= ? new ?CodeMemberField( " string " ,? " m_BriefcaseName " );
????????????cmfBriefcaseName.Attributes?
= ?MemberAttributes.Private;
????????????ctd.Members.Add(cmfBriefcaseName);

????????????CodeMemberField?cmfBriefcaseTitle?
= ? new ?CodeMemberField( " string " ,? " m_BriefcaseTitle " );
????????????cmfBriefcaseTitle.Attributes?
= ?MemberAttributes.Private;
????????????ctd.Members.Add(cmfBriefcaseTitle);

????????????CodeMemberField?cmfBriefcaseID?
= ? new ?CodeMemberField( " int " ,? " m_cmfBriefcaseID " );
????????????cmfBriefcaseID.Attributes?
= ?MemberAttributes.Private;
????????????ctd.Members.Add(cmfBriefcaseID);

????????????CodeMemberField?cmfBriefcaseSectionID?
= ? new ?CodeMemberField( " int " ,? " m_BriefcaseSectionID " );
????????????cmfBriefcaseSectionID.Attributes?
= ?MemberAttributes.Private;
????????????ctd.Members.Add(cmfBriefcaseSectionID);

????????????CodeMemberField?cmfBriefcaseFolderID?
= ? new ?CodeMemberField( " int " ,? " m_BriefcaseFolderID " );
????????????cmfBriefcaseFolderID.Attributes?
= ?MemberAttributes.Private;
????????????ctd.Members.Add(cmfBriefcaseFolderID);

????????????CodeMemberField?cmfBriefcaseItemID?
= ? new ?CodeMemberField( " int " ,? " m_BriefcaseItemID " );
????????????cmfBriefcaseItemID.Attributes?
= ?MemberAttributes.Private;
????????????ctd.Members.Add(cmfBriefcaseItemID);

????????????
// Create?Class?Constructor????????????????
????????????CodeConstructor?ccon? = ? new ?CodeConstructor();
????????????ccon.Attributes?
= ?MemberAttributes.Public;
????????????ccon.Statements.Add(
new ?CodeSnippetStatement( " // " ));
????????????ccon.Statements.Add(
new ?CodeSnippetStatement( " //?TODO:?Add?constructor?logic?here " ));
????????????ccon.Statements.Add(
new ?CodeSnippetStatement( " // " ));
????????????ctd.Members.Add(ccon);

????????????
// 85:????? // Create?Class?BriefcaseName?Property
????????????
// 86:?????CodeMemberProperty?mpBriefcaseName?=?new?CodeMemberProperty();
????????????
// 87:?????mpBriefcaseName.Attributes?=?MemberAttributes.Private;
????????????
// 88:?????mpBriefcaseName.Type?=?new?CodeTypeReference("string");
????????????
// 89:?????mpBriefcaseName.Name?=?"BriefcaseName";????????????????
????????????
// 90:?????mpBriefcaseName.HasGet?=?true;????????????
????????????
// 91:?????mpBriefcaseName.GetStatements.Add(new?CodeSnippetExpression("return?m_BriefcaseName"));
????????????
// 92:?????mpBriefcaseName.HasSet?=?true;
????????????
// 93:?????mpBriefcaseName.SetStatements.Add(new?CodeSnippetExpression("m_BriefcaseName?=?value"));
????????????
// 94:?????ctd.Members.Add(mpBriefcaseName);????????????
????????????
// 95:????????????
????????????
// 96:????? // Create?Class?BriefcaseTitle?Property
????????????
// 97:?????CodeMemberProperty?mpBriefcaseTitle?=?new?CodeMemberProperty();
????????????
// 98:?????mpBriefcaseTitle.Attributes?=?MemberAttributes.Private;
????????????
// 99:?????mpBriefcaseTitle.Type?=?new?CodeTypeReference("string");
????????????
// 100:?????mpBriefcaseTitle.Name?=?"BriefcaseTitle";????????????
????????????
// 101:?????mpBriefcaseTitle.HasGet?=?true;
????????????
// 102:??????mpBriefcaseTitle.GetStatements.Add(new?CodeSnippetExpression("return?m_BriefcaseTitle"));
????????????
// 103:??????mpBriefcaseTitle.HasSet?=?true;
????????????
// 104:??????mpBriefcaseTitle.SetStatements.Add(new?CodeSnippetExpression("m_BriefcaseTitle?=?value"));
????????????
// 105:??????ctd.Members.Add(mpBriefcaseTitle);
????????????
// 106:
????????????
// 107:?????? // Create?Class?BriefcaseID?Property
????????????
// 108:??????CodeMemberProperty?mpBriefcaseID?=?new?CodeMemberProperty();
????????????
// 109:??????mpBriefcaseID.Attributes?=?MemberAttributes.Private;
????????????
// 110:??????mpBriefcaseID.Type?=?new?CodeTypeReference("int");
????????????
// 111:??????mpBriefcaseID.Name?=?"BriefcaseID";????????
????????????
// 112:??????mpBriefcaseID.HasGet?=?true;
????????????
// 113:??????mpBriefcaseID.GetStatements.Add(new?CodeSnippetExpression("m_BriefcaseID"));
????????????
// 114:??????mpBriefcaseID.HasSet?=?true;
????????????
// 115:??????mpBriefcaseID.SetStatements.Add(new?CodeSnippetExpression("m_BriefcaseID?=?value"));
????????????
// 116:??????ctd.Members.Add(mpBriefcaseID);
????????????
// 117:
????????????
// 118:?????? // Create?Class?BriefcaseSection?Property
????????????
// 119:??????CodeMemberProperty?mpBriefcaseSection?=?new?CodeMemberProperty();
????????????
// 120:??????mpBriefcaseSection.Attributes?=?MemberAttributes.Private;
????????????
// 121:??????mpBriefcaseSection.Type?=?new?CodeTypeReference("int");
????????????
// 122:??????mpBriefcaseSection.Name?=?"BriefcaseSection";????????????????
????????????
// 123:??????mpBriefcaseSection.HasGet?=?true;
????????????
// 124:??????mpBriefcaseSection.GetStatements.Add(new?CodeSnippetExpression
????????????
// 125:??????????("return?m_BriefcaseSectionID"));
????????????
// 126:??????mpBriefcaseSection.HasSet?=?true;
????????????
// 127:??????mpBriefcaseSection.SetStatements.Add(new?CodeSnippetExpression
????????????
// 128:??????????("m_BriefcaseSectionID?=?value"));
????????????
// 129:??????ctd.Members.Add(mpBriefcaseSection);
????????????
??????????????????
// Create?Class?BriefcaseFolder?Property
??????????????????CodeMemberProperty?mpBriefcaseFolder? = ? new ?CodeMemberProperty();
??????????????????mpBriefcaseFolder.Attributes?
= ?MemberAttributes.Private;
??????????????????mpBriefcaseFolder.Type?
= ? new ?CodeTypeReference( " int " );
??????????????????mpBriefcaseFolder.Name?
= ? " BriefcaseFolder " ;????????????
??????????????????mpBriefcaseFolder.HasGet?
= ? true ;
??????????????????mpBriefcaseFolder.GetStatements.Add(
new ?CodeSnippetExpression( " return?m_BriefcaseFlderID " ));
??????????????????mpBriefcaseFolder.HasSet?
= ? true ;
??????????????????mpBriefcaseFolder.SetStatements.Add(
new ?CodeSnippetExpression( " m_BriefcaseFolderID?=?value " ));
??????????????????ctd.Members.Add(mpBriefcaseFolder);
????????????
??????????????????
// Create?Class?BriefcaseItem?Property
??????????????????CodeMemberProperty?mpBriefcaseItem? = ? new ?CodeMemberProperty();
??????????????????mpBriefcaseItem.Attributes?
= ?MemberAttributes.Private;
??????????????????mpBriefcaseItem.Type?
= ? new ?CodeTypeReference( " string " );
??????????????????mpBriefcaseItem.Name?
= ? " BriefcaseItem " ;????????
??????????????????mpBriefcaseItem.HasGet?
= ? true ;
??????????????????mpBriefcaseItem.GetStatements.Add(
new ?CodeSnippetExpression( " return?m_BriefcaseItemID " ));
??????????????????mpBriefcaseItem.HasSet?
= ? true ;
??????????????????mpBriefcaseItem.SetStatements.Add(
new ?CodeSnippetExpression( " m_BriefcaseItemID?=?value " ));
??????????????????ctd.Members.Add(mpBriefcaseItem);????????????

????????????
// Create?Class?GetBriefcaseName?Method
????????????CodeMemberMethod?mtd1? = ? new ?CodeMemberMethod();
????????????mtd1.Name?
= ? " GetBriefcaseName " ;
????????????mtd1.ReturnType?
= ? new ?CodeTypeReference( " String " );
????????????mtd1.Attributes?
= ?MemberAttributes.Public;
????????????mtd1.Statements.Add(
new ?CodeSnippetStatement( " return?BriefcaseName; " ));
????????????ctd.Members.Add(mtd1);

????????????
// Create?Class?GetBriefcaseTitle?Method
????????????CodeMemberMethod?mtd2? = ? new ?CodeMemberMethod();
????????????mtd2.Name?
= ? " GetBriefcaseTitle " ;
????????????mtd2.ReturnType?
= ? new ?CodeTypeReference( " String " );
????????????mtd2.Attributes?
= ?MemberAttributes.Public;
????????????mtd2.Statements.Add(
new ?CodeSnippetStatement( " return?BriefcaseTitle; " ));
????????????ctd.Members.Add(mtd2);

????????????
// Create?Class?GetBriefcaseID?Method
????????????CodeMemberMethod?mtd3? = ? new ?CodeMemberMethod();
????????????mtd3.Name?
= ? " GetBriefcaseID " ;
????????????mtd3.ReturnType?
= ? new ?CodeTypeReference( " Int " );
????????????mtd3.Attributes?
= ?MemberAttributes.Public;
????????????mtd3.Statements.Add(
new ?CodeSnippetStatement( " return?BriefcaseID; " ));
????????????ctd.Members.Add(mtd3);

????????????
// Create?Class?GetBriefcaseSection?Method
????????????CodeMemberMethod?mtd4? = ? new ?CodeMemberMethod();
????????????mtd4.Name?
= ? " GetBriefcaseSectionID " ;
????????????mtd4.ReturnType?
= ? new ?CodeTypeReference( " Int " );
????????????mtd4.Attributes?
= ?MemberAttributes.Public;
????????????mtd4.Statements.Add(
new ?CodeSnippetStatement( " return?BriefcaseSectionID; " ));
????????????ctd.Members.Add(mtd4);

????????????
// Create?Class?GetBriefcaseFolder?Method
????????????CodeMemberMethod?mtd5? = ? new ?CodeMemberMethod();
????????????mtd5.Name?
= ? " GetBriefcaseFolderID " ;
????????????mtd5.ReturnType?
= ? new ?CodeTypeReference( " Int " );
????????????mtd5.Attributes?
= ?MemberAttributes.Public;
????????????mtd5.Statements.Add(
new ?CodeSnippetStatement( " return?BriefcaseFolderID; " ));
????????????ctd.Members.Add(mtd5);

????????????
// Create?Class?GetBriefcaseItem?Method
????????????CodeMemberMethod?mtd6? = ? new ?CodeMemberMethod();
????????????mtd6.Name?
= ? " GetBriefcaseItemID " ;
????????????mtd6.ReturnType?
= ? new ?CodeTypeReference( " Int " );
????????????mtd6.Attributes?
= ?MemberAttributes.Public;
????????????mtd6.Statements.Add(
new ?CodeSnippetStatement( " return?BriefcaseItemID; " ));
????????????ctd.Members.Add(mtd6);

????????????
// Generate?Source?Code?File
????????????cnsCodeDom.Types.Add(ctd);
????????????cscg.GenerateCodeFromNamespace(cnsCodeDom,?sw,?cop);
????????????
// cscg.GenerateCodeFromType(ctd,sw,cop);
????????????
????????????
// Close?StreamWriter
????????????sw.Close();
????????????s.Close();
????????}

????}

}


由以上代碼生成:
using?System
using?System.IO


namespace?CodeDom?{????
????
????
public?class?Briefcase?
????
{
????????
????????
private?@string?m_BriefcaseName;
????????
????????
private?@string?m_BriefcaseTitle;
????????
????????
private?@int?m_cmfBriefcaseID;
????????
????????
private?@int?m_BriefcaseSectionID;
????????
????????
private?@int?m_BriefcaseFolderID;
????????
????????
private?@int?m_BriefcaseItemID;
????????
????????
public?Briefcase()?
????????
{

????????}

????????
????????
private?@int?BriefcaseFolder
????????
{
????????????
get?{
????????????????
return?m_BriefcaseFlderID;
????????????}

????????????
set?{
????????????????m_BriefcaseFolderID?
=?value;
????????????}

????????}

????????
????????
private?@string?BriefcaseItem?
????????
{
????????????
get?{
????????????????
return?m_BriefcaseItemID;
????????????}

????????????
set?{
????????????????m_BriefcaseItemID?
=?value;
????????????}

????????}

????????
????????
public?virtual?String?GetBriefcaseName()
????????
{
????????????
return?BriefcaseName;
????????}

????????
????????
public?virtual?String?GetBriefcaseTitle()?
????????
{
????????????
return?BriefcaseTitle;
????????}

????????
????????
public?virtual?Int?GetBriefcaseID()
????????
{
????????????
return?BriefcaseID;
????????}

????????
????????
public?virtual?Int?GetBriefcaseSectionID()?
????????
{
????????????
return?BriefcaseSectionID;
????????}

????????
????????
public?virtual?Int?GetBriefcaseFolderID()?
????????
{
????????????
return?BriefcaseFolderID;
????????}

????????
????????
public?virtual?Int?GetBriefcaseItemID()?
????????
{
????????????
return?BriefcaseItemID;
????????}

????}

}


Advantages of CodeDom Technology

The CodeDom namespaces in the .NET Framework provide these advantages:

  1. The CodeDom is based upon a single model for rendering source code. Therefore, source code may be generated for any language that supports the CodeDom specification.
  2. The CodeDom allows programs to be dynamically created, compiled, and executed at runtime.
  3. The CodeDom provides a language independent object model for representing the structure of source code in memory.
  4. Future releases of the CodeDom could translate source code files between languages a lot like graphic file converter programs do with graphics files today. For example, a VB.NET program could be represented by the CodeDom then translated into C# for another developer. Cool huh?

Limitations of CodeDom Technology

The CodeDom namespaces contain classes to conceptually represent most programming constructs. Examples of these include: declarations, statements, iterations, arrays, casts, comments, error handling, and others. However, there are limitations to the current implementation of the CodeDom which will remain until the CodeDom namespaces are updated by Microsoft. In the meanwhile, to represent constructs not presently supported in CodeDom you can use the "Snippet" classes. These classes allow you to insert literal lines of source code into a compile unit. The classes available for handling snippets include: the CodeSnippetCompileUnit, CodeSnippetExpression, CodeSnippetStatement, and CodeSnippetTypeMember classes. You can use the snippet classes as a generic "catch all" for implementing presently unsupported programming constructs in the CodeDom. As the CodeDom namespaces are enhanced by Microsoft, you should not need to rely as heavily upon the snippet classes. As with any new technology, there are limitations to its functionality - CodeDom technology is no exception. We will look at four useful programming constructs not presently supported by the CodeDom. There are many more examples of missing constructs unsupported by the current implementation of CodeDom, but these should give you an idea of the enhancements forthcoming in the CodeDom namespaces.

  1. Limitation #1: There is no support for aliasing a namespace.
    
             namespace MyNamespace
         {
              public void MyClass
              {
              }
         }
         namespace MyNamespace2
         {
              using MyAlias = MyNamespace.MyClass;
              public void MyClass2 : MyAlias
              {
              }
                 }
    
  2. Limitation #2: There is no support for nested namespaces.
    namespace OutterNamespace
         {
              namespace InnerNamespace
              {
                   public void MyClass
                   {
                   }
              }
          }
    
  3. Limitation #3: There is no support for variable declaration lists.
    
         using System;
          using System.CodeDom;
          using System.CodeDom.Compiler;
    
          namespace MyNamespace
          {
              public void MyClass
              {
                  public void MyClass()
                  {
                      int i,j,k;
                      bool blnYes, blnNo;
                  }
              }
          }
    
  4. Limitation #4: There is no support for the "unsafe" modifier in C#.
    
         using System;
    
          class MyUnsafeClass
          {
             unsafe static void MyPointerFn(int* ptr)
              {
                  *p *= *p;
              {
          {
          unsafe public static void main()
          {
               //unsafe operation using address-of operator &
               int i = 10;
               MyPointerFn(&i);
               Console.WriteLine(i);
          }
    

System.CodeDom Namespace Overview

The System.CodeDom Namespace contains classes, interfaces and enumerations to represent source code trees in memory. Each source code tree is called a CompileUnit. CompileUnits are linked together to form a tree structure in memory representing the structure of the source code. Remember our discussion on trees? Each CodeDom class is analogous to a node in the source tree. Each CodeDom node contains data which is used by the ICodeGenerator Interface later on. The ICodeGenerator Interface is what receives the Compile Units and outputs source code in the designated language. Compile Units are the key to understanding how the CodeDom creates the internal representation of the source code in memory.

?

System.CodeDom Enumerations

CodeBinaryOperatorType

Specifies identifiers for supported binary operators.

FieldDirection

Specifies identifiers used to indicate the direction of parameter and argument declarations.

MemberAttributes

Specifies member attribute identifiers for class members.

?

?

System.CodeDom Classes

CodeArgumentReferenceExpression

Represents a reference to an argument.

CodeArrayCreateExpression

Represents an expression that creates an array.

CodeArrayIndexerExpression

Represents an expression that indicates an array and a specific index or indices.

CodeAssignStatement

Represents a simple assignment statement.

CodeAttachEventStatement

Represents a statement that attaches an event handler.

CodeAttributeArgument

Represents an argument used in a metadata custom attribute declaration.

CodeAttributeArgumentCollection

Represents a collection of CodeAttributeArgument objects.

CodeAttributeDeclaration

Represents an attribute declaration.

CodeAttributeDeclarationCollection

Represents a collection of CodeAttributeDeclaration objects.

CodeBaseReferenceExpression

Represents a reference to the base class.

CodeBinaryOperatorExpression

Represents an expression that consists of a binary operation between two expressions.

CodeCastExpression

Represents an expression that is to be cast to a data type or interface.

CodeCatchClause

Represents a catch exception block.

CodeCatchClauseCollection

Represents a collection of CodeCatchClause objects.

CodeComment

Represents a comment.

CodeCommentStatement

Represents a statement consisting of a single comment.

CodeCommentStatementCollection

Represents a collection of CodeCommentStatement objects.

CodeCompileUnit

Provides a top-level object to use for compilation.

CodeConditionStatement

Represents a conditional branch statement, typically represented as an if statement.

CodeConstructor

Represents the declaration of an instance constructor for a type.

CodeDelegateCreateExpression

Represents an expression that creates a delegate.

CodeDelegateInvokeExpression

Represents an expression that invokes a delegate.

CodeDirectionExpression

Represents an expression that indicates the direction type of the reference.

CodeEntryPointMethod

Represents the entry point of an executable.

CodeEventReferenceExpression

Represents an expression that references an event.

CodeExpression

Represents a code expression. This is a base class for other code expression objects that is never instantiated.

CodeExpressionCollection

Represents a collection of CodeExpression objects.

CodeExpressionStatement

Represents a statement that consists of a single expression.

CodeFieldReferenceExpression

Represents a reference to a field.

CodeGotoStatement

Represents a goto statement.

CodeIndexerExpression

Represents a reference to an indexer property of an object.

CodeIterationStatement

Represents a for statement, or a simple loop through a block of statements, using a test expression as a condition for continuing to loop.

CodeLabeledStatement

Represents a labeled statement or a stand-alone label.

CodeLinePragma

Represents a specific location within a specific file.

CodeMemberEvent

Represents an event member of a class.

CodeMemberField

Represents a field class member declaration.

CodeMemberMethod

Represents a declaration for a method of a class.

CodeMemberProperty

Represents a declaration for a property of a class.

CodeMethodInvokeExpression

Represents an expression that invokes a method.

CodeMethodReferenceExpression

Represents an expression that references a method on a specific object.

CodeMethodReturnStatement

Represents a return statement.

CodeNamespace

Represents a namespace declaration.

CodeNamespaceCollection

Represents a collection of CodeNamespace objects.

CodeNamespaceImport

Represents a namespace import directive that indicates a namespace to use.

CodeNamesapceImportCollection

Represents a collection of CodeNamespaceImport objects.

CodeObject

Provides a common base class for most Code Document Object Model (CodeDOM) objects.

CodeObjectCreateExpression

Represents an expression that creates a new instance of an object.

CodeParamaterDeclarationExpression

Represents a parameter declaration for a method, property, or constructor.

CodeParameterDeclarationExpressionCollection

Represents a collection of CodeParameterDeclarationExpression objects.

CodePrimitiveExpression

Represents a primitive data type value.

CodePropertyReferenceExpression

Represents a reference to a property.

CodePropertySetValueReferenceExpression

Represents an expression that represents the value argument of a property set method call within a property set method declaration.

CodeRemoveEventStatement

Represents a statement that removes an event handler.

CodeSnippetCompileUnit

Represents a literal code fragment that can be compiled.

CodeSnippetExpression

Represents a literal expression.

CodeSnippetStatement

Represents a statement using a literal code fragment.

CodeSnippetTypeMember

Represents a member of a class using a literal code fragment.

CodeStatementCollection

Represents a collection ofCodeStatement objects.

CodeThisReferenceExpression

Represents a reference to the current local class instance.

CodeThrowExceptionStatement

Represents a statement that throws an exception.

CodeTryCatchFinallyStatement

Represents a try block, with any number of catch clauses and optionally, a finally block.

CodeTypeConstructor

Represents a static constructor for a class.

CodeTypeDeclaration

Represents a type declaration for a class, structure, interface or enumeration.

CodeTypeDeclarationCollection

Represents a collection of CodeTypeDeclaration objects.

CodeTypeDelegate

Represents a delegate declaration.

CodeTypeMember

Represents the declaration for a member of a type. Type members include fields, methods, properties, constructors and nested types.

CodeTypeMemberCollection

Represents a collection of CodeTypeMember objects.

CodeTypeOfExpression

Represents a typeof expression, an expression that returns a specified runtime type.

CodeTypeReference

Represents a data type to CodeDOM objects.

CodeTypeReferenceCollection

Represents a collection of CodeTypeReference objects.

CodeTypeReferenceExpression

Represents a reference to a data type.

CodeVariableDeclarationStatement

Represents a declaration of a variable.

CodeVariableReferenceExpression

Represents an expression that references a local variable.

System.CodeDom.Compiler Namespace Overview

The System.CodeDom.Compiler namespace contains enumerations, interfaces and classes used to generate and compile source code. Compile Units created using the System.CodeDom namespace are collected and processed by the System.CodeDom.Compiler namespace. When generating source code, CompileUnits are processed by three main interfaces: the ICodeParser, ICodeGenerator, and ICodeCompiler Interfaces. The ICodeParser Interface parses the CompileUnit trees into a structure in memory. The ICodeGenerator Interface reads the output of the ICodeParser Interface and physically generates the source code files in the desired language. The ICodeCompiler Interface receives source code files as input and compiles the source code into assemblies. The key to understanding the System.CodeDom.Compiler namespace is to learn how the three exposed interfaces work: the ICodeParser, ICodeCompiler, and ICodeCompiler Interfaces. In short, the System.CodeDom.Compiler namespace operates on the premise of having tree structures called Compile Units already built and ready to be parsed, generated and compiled.

?

System.CodeDom.Compiler Enumerations

GeneratorSupport

Specifies identifiers used to determine whether a code generator supports certain types of code.

LanguageOptions

Specifies identifiers that indicate special features of a language.

?

?

System.CodeDom.Compiler Interfaces

ICodeCompiler

Provides a compiler execution interface.

ICodeGenerator

Provides an interface for generating code.

ICodeParser

Specifies an interface for parsing code into a CodeCompileUnit.

?

?

System.CodeDom.Compiler Classes

CodeCompiler

Provides a helper class for implementing an ICodeCompiler.

CodeDomProvider

Provides a base class for CodeDomProvider implementations. This class is abstract.

CodeGenerator

Provides a helper class for implementing an ICodeGenerator. This class is abstract.

CodeGeneratorOptions

Represents options used by code generators.

CodeParser

Provides a helper class for implementing an ICodeParser.

CompilerError

Represents a compiler error or warning.

CompilerErrorCollection

Represents a collection of CompilerError objects.

CompilerParameters

Represents the parameters used to invoke the compiler.

CompilerResults

Represents the results of compilation that are returned from the compiler.

Executor

Provides command execution functions for invoking compilers. This class cannot be inherited.

IndentedTextWriter

Provides a text writer that can indent new lines by a tab string token.

TempFileCollection

Represents a collection of temporary files.

posted on 2006-05-09 13:58 夢(mèng)在天涯 閱讀(1085) 評(píng)論(0)  編輯 收藏 引用 所屬分類: C#/.NET

公告

EMail:itech001#126.com

導(dǎo)航

統(tǒng)計(jì)

  • 隨筆 - 461
  • 文章 - 4
  • 評(píng)論 - 746
  • 引用 - 0

常用鏈接

隨筆分類

隨筆檔案

收藏夾

Blogs

c#(csharp)

C++(cpp)

Enlish

Forums(bbs)

My self

Often go

Useful Webs

Xml/Uml/html

搜索

  •  

積分與排名

  • 積分 - 1817750
  • 排名 - 5

最新評(píng)論

閱讀排行榜

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
      <noscript id="pjuwb"></noscript>
            <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
              <dd id="pjuwb"></dd>
              <abbr id="pjuwb"></abbr>
              久久九九热免费视频| 在线欧美福利| 国产一区二区三区在线播放免费观看| 国产日韩欧美视频| 日韩一区二区福利| 午夜欧美精品久久久久久久| 久久另类ts人妖一区二区| 亚洲福利国产| 午夜精品久久久99热福利| 日韩视频在线观看免费| 香蕉尹人综合在线观看| 免费日韩av片| 国产精品久久99| 在线播放日韩欧美| 亚洲欧美日产图| 米奇777在线欧美播放| 一区二区三区精品视频在线观看| 久久国产视频网站| 国产精品video| 亚洲九九精品| 久久只有精品| 亚洲资源在线观看| 蘑菇福利视频一区播放| 亚洲国产视频一区二区| 欧美呦呦网站| 亚洲精选视频在线| 男人的天堂亚洲在线| 亚洲精品国产日韩| 免费看成人av| 欧美不卡视频一区| 国产一区香蕉久久| 亚洲免费中文| 欧美与欧洲交xxxx免费观看| 国产精品欧美一区喷水| 一本久道久久综合中文字幕| 欧美+日本+国产+在线a∨观看| 午夜国产不卡在线观看视频| 欧美日韩综合在线免费观看| 亚洲欧洲日本在线| 欧美a级大片| 欧美精品1区| 一区二区视频免费在线观看| 久久久久久久久久久一区| 99视频一区二区| 欧美激情中文字幕乱码免费| 亚洲免费小视频| 久久久精品一品道一区| 亚洲精品一区二区三区樱花 | 国产精品jizz在线观看美国 | 久久国产日本精品| 日韩亚洲欧美精品| 亚洲欧美在线播放| 亚洲国产精品久久| 免费成人黄色av| 欧美麻豆久久久久久中文| 亚洲国产婷婷香蕉久久久久久99| 亚洲伦理精品| 国产字幕视频一区二区| 亚洲激情成人网| 欧美成人午夜剧场免费观看| 亚洲综合清纯丝袜自拍| 日韩视频在线免费| 黄色成人免费观看| 欧美1区3d| 国产精品入口日韩视频大尺度| 免费在线成人av| 国产精品国产三级国产aⅴ9色 | 久久精品导航| 亚洲欧美综合国产精品一区| 亚洲国产精品t66y| 亚洲在线视频| 国产自产女人91一区在线观看| 亚洲欧洲精品一区二区三区不卡 | 99视频在线精品国自产拍免费观看| 国产网站欧美日韩免费精品在线观看| 亚洲高清久久| 国产一区二区三区黄视频| 亚洲卡通欧美制服中文| 黄色日韩精品| 亚洲一区二区成人| 亚洲精选在线| 久久日韩粉嫩一区二区三区| 亚洲国内在线| 香蕉久久久久久久av网站| 中文在线一区| 亚洲午夜极品| 在线播放国产一区中文字幕剧情欧美 | 亚洲欧美日韩精品久久久久| 麻豆精品视频在线观看| 中文网丁香综合网| 免费在线一区二区| 久久这里只精品最新地址| 国产精品日韩精品欧美精品| 亚洲精品影院| 亚洲欧洲日韩综合二区| 久久精品动漫| 欧美一区二区啪啪| 欧美色精品天天在线观看视频| 欧美国产亚洲精品久久久8v| 欧美日韩国产综合视频在线观看中文 | 亚洲国产欧美不卡在线观看| 欧美性猛交99久久久久99按摩| 亚洲二区视频在线| 亚洲第一精品电影| 久久久久九九九九| 亚洲一区二区不卡免费| 欧美在线综合| 欧美一级视频免费在线观看| 久久婷婷一区| 久久综合中文| 欧美视频在线观看一区二区| 亚洲黄色天堂| 亚洲级视频在线观看免费1级| 久久精品中文字幕一区| 久久精品视频免费| 国产日韩精品一区二区| 亚洲二区在线观看| 亚洲国产一区二区三区高清| 久久精品日韩| 噜噜噜91成人网| 在线观看欧美日本| 久久国产精品亚洲77777| 久久福利影视| 国产精品国产一区二区| 一本色道久久综合亚洲精品不 | 日韩视频免费观看高清完整版| 蜜桃av一区二区三区| 欧美成人精品在线视频| 欧美日韩精品一区| 亚洲久久成人| 亚洲综合精品| 国产精品进线69影院| 亚洲一区二区在线播放| 亚洲欧美一区二区精品久久久| 国产精品成人免费| 亚洲一区在线观看免费观看电影高清| 亚洲欧美另类在线观看| 国产精品视频精品| 性色av一区二区怡红| 久久久精品五月天| 一区在线免费| 免费中文日韩| 日韩系列在线| 先锋影音网一区二区| 国产欧美在线看| 久久国产主播| 欧美黄色视屏| 一本一本久久a久久精品综合麻豆| 欧美日韩系列| 亚洲高清资源综合久久精品| 亚洲精品视频一区| 欧美日韩在线播| 午夜在线成人av| 你懂的视频一区二区| 亚洲毛片av在线| 国产精品黄页免费高清在线观看| 亚洲欧美精品在线| 美日韩精品免费| 99精品热6080yy久久| 国产精品国产福利国产秒拍 | 亚洲欧美国产制服动漫| 国产精品亚洲精品| 久久久国产精品一区二区中文| 亚洲高清免费| 亚洲欧美国产另类| 极品尤物一区二区三区| 欧美激情一二三区| 亚洲永久免费精品| 蜜桃精品久久久久久久免费影院| 日韩午夜中文字幕| 国产精品视频免费观看www| 久久精品一二三区| 亚洲精品欧洲精品| 久久都是精品| 99国产精品久久久久久久成人热| 国产精品普通话对白| 久久人人爽人人爽爽久久| 亚洲精品在线电影| 久久精品一区中文字幕| 亚洲人午夜精品免费| 国产精品毛片a∨一区二区三区|国| 亚洲视频精品| 欧美一区二区高清在线观看| 狠狠色伊人亚洲综合网站色 | 欧美激情在线有限公司| 一区二区三区久久精品| 欧美日韩一区二区三区四区在线观看| 亚洲伊人网站| 亚洲高清在线视频| 欧美有码在线视频| 亚洲免费久久| 国产一区二区三区四区五区美女| 欧美激情中文字幕乱码免费| 欧美一级久久久久久久大片| 久久久蜜桃一区二区人| 中日韩高清电影网| 又紧又大又爽精品一区二区| 国产精品乱码一区二三区小蝌蚪| 美女亚洲精品| 亚洲欧美在线一区二区|