Muokkaa

Jaa


CodeCompiler Class

Definition

Provides an example implementation of the ICodeCompiler interface.

public ref class CodeCompiler abstract : System::CodeDom::Compiler::CodeGenerator, System::CodeDom::Compiler::ICodeCompiler
public abstract class CodeCompiler : System.CodeDom.Compiler.CodeGenerator, System.CodeDom.Compiler.ICodeCompiler
type CodeCompiler = class
    inherit CodeGenerator
    interface ICodeCompiler
Public MustInherit Class CodeCompiler
Inherits CodeGenerator
Implements ICodeCompiler
Inheritance
CodeCompiler
Implements

Remarks

CodeCompiler is a useful utility base class for code generators to derive from in order to provide code compilation functions.

Note

This class contains a link demand and an inheritance demand at the class level that applies to all members. A SecurityException is thrown when either the immediate caller or the derived class does not have full-trust permission. For details about security demands, see Link Demands and Inheritance Demands.

Constructors

CodeCompiler()

Initializes a new instance of the CodeCompiler class.

Properties

CompilerName

Gets the name of the compiler executable.

CurrentClass

Gets the code type declaration for the current class.

(Inherited from CodeGenerator)
CurrentMember

Gets the current member of the class.

(Inherited from CodeGenerator)
CurrentMemberName

Gets the current member name.

(Inherited from CodeGenerator)
CurrentTypeName

Gets the current class name.

(Inherited from CodeGenerator)
FileExtension

Gets the file name extension to use for source files.

Indent

Gets or sets the amount of spaces to indent each indentation level.

(Inherited from CodeGenerator)
IsCurrentClass

Gets a value indicating whether the current object being generated is a class.

(Inherited from CodeGenerator)
IsCurrentDelegate

Gets a value indicating whether the current object being generated is a delegate.

(Inherited from CodeGenerator)
IsCurrentEnum

Gets a value indicating whether the current object being generated is an enumeration.

(Inherited from CodeGenerator)
IsCurrentInterface

Gets a value indicating whether the current object being generated is an interface.

(Inherited from CodeGenerator)
IsCurrentStruct

Gets a value indicating whether the current object being generated is a value type or struct.

(Inherited from CodeGenerator)
NullToken

Gets the token that represents null.

(Inherited from CodeGenerator)
Options

Gets the options to be used by the code generator.

(Inherited from CodeGenerator)
Output

Gets the text writer to use for output.

(Inherited from CodeGenerator)

Methods

CmdArgsFromParameters(CompilerParameters)

Gets the command arguments to be passed to the compiler from the specified CompilerParameters.

ContinueOnNewLine(String)

Generates a line-continuation character and outputs the specified string on a new line.

(Inherited from CodeGenerator)
CreateEscapedIdentifier(String)

Creates an escaped identifier for the specified value.

(Inherited from CodeGenerator)
CreateValidIdentifier(String)

Creates a valid identifier for the specified value.

(Inherited from CodeGenerator)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
FromDom(CompilerParameters, CodeCompileUnit)

Compiles the specified compile unit using the specified options, and returns the results from the compilation.

FromDomBatch(CompilerParameters, CodeCompileUnit[])

Compiles the specified compile units using the specified options, and returns the results from the compilation.

FromFile(CompilerParameters, String)

Compiles the specified file using the specified options, and returns the results from the compilation.

FromFileBatch(CompilerParameters, String[])

Compiles the specified files using the specified options, and returns the results from the compilation.

FromSource(CompilerParameters, String)

Compiles the specified source code string using the specified options, and returns the results from the compilation.

FromSourceBatch(CompilerParameters, String[])

Compiles the specified source code strings using the specified options, and returns the results from the compilation.

GenerateArgumentReferenceExpression(CodeArgumentReferenceExpression)

Generates code for the specified argument reference expression.

(Inherited from CodeGenerator)
GenerateArrayCreateExpression(CodeArrayCreateExpression)

Generates code for the specified array creation expression.

(Inherited from CodeGenerator)
GenerateArrayIndexerExpression(CodeArrayIndexerExpression)

Generates code for the specified array indexer expression.

(Inherited from CodeGenerator)
GenerateAssignStatement(CodeAssignStatement)

Generates code for the specified assignment statement.

(Inherited from CodeGenerator)
GenerateAttachEventStatement(CodeAttachEventStatement)

Generates code for the specified attach event statement.

(Inherited from CodeGenerator)
GenerateAttributeDeclarationsEnd(CodeAttributeDeclarationCollection)

Generates code for the specified attribute block end.

(Inherited from CodeGenerator)
GenerateAttributeDeclarationsStart(CodeAttributeDeclarationCollection)

Generates code for the specified attribute block start.

(Inherited from CodeGenerator)
GenerateBaseReferenceExpression(CodeBaseReferenceExpression)

Generates code for the specified base reference expression.

(Inherited from CodeGenerator)
GenerateBinaryOperatorExpression(CodeBinaryOperatorExpression)

Generates code for the specified binary operator expression.

(Inherited from CodeGenerator)
GenerateCastExpression(CodeCastExpression)

Generates code for the specified cast expression.

(Inherited from CodeGenerator)
GenerateCodeFromMember(CodeTypeMember, TextWriter, CodeGeneratorOptions)

Generates code for the specified class member using the specified text writer and code generator options.

(Inherited from CodeGenerator)
GenerateComment(CodeComment)

Generates code for the specified comment.

(Inherited from CodeGenerator)
GenerateCommentStatement(CodeCommentStatement)

Generates code for the specified comment statement.

(Inherited from CodeGenerator)
GenerateCommentStatements(CodeCommentStatementCollection)

Generates code for the specified comment statements.

(Inherited from CodeGenerator)
GenerateCompileUnit(CodeCompileUnit)

Generates code for the specified compile unit.

(Inherited from CodeGenerator)
GenerateCompileUnitEnd(CodeCompileUnit)

Generates code for the end of a compile unit.

(Inherited from CodeGenerator)
GenerateCompileUnitStart(CodeCompileUnit)

Generates code for the start of a compile unit.

(Inherited from CodeGenerator)
GenerateConditionStatement(CodeConditionStatement)

Generates code for the specified conditional statement.

(Inherited from CodeGenerator)
GenerateConstructor(CodeConstructor, CodeTypeDeclaration)

Generates code for the specified constructor.

(Inherited from CodeGenerator)
GenerateDecimalValue(Decimal)

Generates code for the specified decimal value.

(Inherited from CodeGenerator)
GenerateDefaultValueExpression(CodeDefaultValueExpression)

Generates code for the specified reference to a default value.

(Inherited from CodeGenerator)
GenerateDelegateCreateExpression(CodeDelegateCreateExpression)

Generates code for the specified delegate creation expression.

(Inherited from CodeGenerator)
GenerateDelegateInvokeExpression(CodeDelegateInvokeExpression)

Generates code for the specified delegate invoke expression.

(Inherited from CodeGenerator)
GenerateDirectionExpression(CodeDirectionExpression)

Generates code for the specified direction expression.

(Inherited from CodeGenerator)
GenerateDirectives(CodeDirectiveCollection)

Generates code for the specified code directives.

(Inherited from CodeGenerator)
GenerateDoubleValue(Double)

Generates code for a double-precision floating point number.

(Inherited from CodeGenerator)
GenerateEntryPointMethod(CodeEntryPointMethod, CodeTypeDeclaration)

Generates code for the specified entry point method.

(Inherited from CodeGenerator)
GenerateEvent(CodeMemberEvent, CodeTypeDeclaration)

Generates code for the specified event.

(Inherited from CodeGenerator)
GenerateEventReferenceExpression(CodeEventReferenceExpression)

Generates code for the specified event reference expression.

(Inherited from CodeGenerator)
GenerateExpression(CodeExpression)

Generates code for the specified code expression.

(Inherited from CodeGenerator)
GenerateExpressionStatement(CodeExpressionStatement)

Generates code for the specified expression statement.

(Inherited from CodeGenerator)
GenerateField(CodeMemberField)

Generates code for the specified member field.

(Inherited from CodeGenerator)
GenerateFieldReferenceExpression(CodeFieldReferenceExpression)

Generates code for the specified field reference expression.

(Inherited from CodeGenerator)
GenerateGotoStatement(CodeGotoStatement)

Generates code for the specified goto statement.

(Inherited from CodeGenerator)
GenerateIndexerExpression(CodeIndexerExpression)

Generates code for the specified indexer expression.

(Inherited from CodeGenerator)
GenerateIterationStatement(CodeIterationStatement)

Generates code for the specified iteration statement.

(Inherited from CodeGenerator)
GenerateLabeledStatement(CodeLabeledStatement)

Generates code for the specified labeled statement.

(Inherited from CodeGenerator)
GenerateLinePragmaEnd(CodeLinePragma)

Generates code for the specified line pragma end.

(Inherited from CodeGenerator)
GenerateLinePragmaStart(CodeLinePragma)

Generates code for the specified line pragma start.

(Inherited from CodeGenerator)
GenerateMethod(CodeMemberMethod, CodeTypeDeclaration)

Generates code for the specified method.

(Inherited from CodeGenerator)
GenerateMethodInvokeExpression(CodeMethodInvokeExpression)

Generates code for the specified method invoke expression.

(Inherited from CodeGenerator)
GenerateMethodReferenceExpression(CodeMethodReferenceExpression)

Generates code for the specified method reference expression.

(Inherited from CodeGenerator)
GenerateMethodReturnStatement(CodeMethodReturnStatement)

Generates code for the specified method return statement.

(Inherited from CodeGenerator)
GenerateNamespace(CodeNamespace)

Generates code for the specified namespace.

(Inherited from CodeGenerator)
GenerateNamespaceEnd(CodeNamespace)

Generates code for the end of a namespace.

(Inherited from CodeGenerator)
GenerateNamespaceImport(CodeNamespaceImport)

Generates code for the specified namespace import.

(Inherited from CodeGenerator)
GenerateNamespaceImports(CodeNamespace)

Generates code for the specified namespace import.

(Inherited from CodeGenerator)
GenerateNamespaces(CodeCompileUnit)

Generates code for the namespaces in the specified compile unit.

(Inherited from CodeGenerator)
GenerateNamespaceStart(CodeNamespace)

Generates code for the start of a namespace.

(Inherited from CodeGenerator)
GenerateObjectCreateExpression(CodeObjectCreateExpression)

Generates code for the specified object creation expression.

(Inherited from CodeGenerator)
GenerateParameterDeclarationExpression(CodeParameterDeclarationExpression)

Generates code for the specified parameter declaration expression.

(Inherited from CodeGenerator)
GeneratePrimitiveExpression(CodePrimitiveExpression)

Generates code for the specified primitive expression.

(Inherited from CodeGenerator)
GenerateProperty(CodeMemberProperty, CodeTypeDeclaration)

Generates code for the specified property.

(Inherited from CodeGenerator)
GeneratePropertyReferenceExpression(CodePropertyReferenceExpression)

Generates code for the specified property reference expression.

(Inherited from CodeGenerator)
GeneratePropertySetValueReferenceExpression(CodePropertySetValueReferenceExpression)

Generates code for the specified property set value reference expression.

(Inherited from CodeGenerator)
GenerateRemoveEventStatement(CodeRemoveEventStatement)

Generates code for the specified remove event statement.

(Inherited from CodeGenerator)
GenerateSingleFloatValue(Single)

Generates code for a single-precision floating point number.

(Inherited from CodeGenerator)
GenerateSnippetCompileUnit(CodeSnippetCompileUnit)

Outputs the code of the specified literal code fragment compile unit.

(Inherited from CodeGenerator)
GenerateSnippetExpression(CodeSnippetExpression)

Outputs the code of the specified literal code fragment expression.

(Inherited from CodeGenerator)
GenerateSnippetMember(CodeSnippetTypeMember)

Outputs the code of the specified literal code fragment class member.

(Inherited from CodeGenerator)
GenerateSnippetStatement(CodeSnippetStatement)

Outputs the code of the specified literal code fragment statement.

(Inherited from CodeGenerator)
GenerateStatement(CodeStatement)

Generates code for the specified statement.

(Inherited from CodeGenerator)
GenerateStatements(CodeStatementCollection)

Generates code for the specified statement collection.

(Inherited from CodeGenerator)
GenerateThisReferenceExpression(CodeThisReferenceExpression)

Generates code for the specified this reference expression.

(Inherited from CodeGenerator)
GenerateThrowExceptionStatement(CodeThrowExceptionStatement)

Generates code for the specified throw exception statement.

(Inherited from CodeGenerator)
GenerateTryCatchFinallyStatement(CodeTryCatchFinallyStatement)

Generates code for the specified try-catch-finally statement.

(Inherited from CodeGenerator)
GenerateTypeConstructor(CodeTypeConstructor)

Generates code for the specified class constructor.

(Inherited from CodeGenerator)
GenerateTypeEnd(CodeTypeDeclaration)

Generates code for the specified end of the class.

(Inherited from CodeGenerator)
GenerateTypeOfExpression(CodeTypeOfExpression)

Generates code for the specified type of expression.

(Inherited from CodeGenerator)
GenerateTypeReferenceExpression(CodeTypeReferenceExpression)

Generates code for the specified type reference expression.

(Inherited from CodeGenerator)
GenerateTypes(CodeNamespace)

Generates code for the specified namespace and the classes it contains.

(Inherited from CodeGenerator)
GenerateTypeStart(CodeTypeDeclaration)

Generates code for the specified start of the class.

(Inherited from CodeGenerator)
GenerateVariableDeclarationStatement(CodeVariableDeclarationStatement)

Generates code for the specified variable declaration statement.

(Inherited from CodeGenerator)
GenerateVariableReferenceExpression(CodeVariableReferenceExpression)

Generates code for the specified variable reference expression.

(Inherited from CodeGenerator)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetResponseFileCmdArgs(CompilerParameters, String)

Gets the command arguments to use when invoking the compiler to generate a response file.

GetType()

Gets the Type of the current instance.

(Inherited from Object)
GetTypeOutput(CodeTypeReference)

Gets the name of the specified data type.

(Inherited from CodeGenerator)
IsValidIdentifier(String)

Gets a value indicating whether the specified value is a valid identifier.

(Inherited from CodeGenerator)
JoinStringArray(String[], String)

Joins the specified string arrays.

MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OutputAttributeArgument(CodeAttributeArgument)

Outputs an argument in an attribute block.

(Inherited from CodeGenerator)
OutputAttributeDeclarations(CodeAttributeDeclarationCollection)

Generates code for the specified attribute declaration collection.

(Inherited from CodeGenerator)
OutputDirection(FieldDirection)

Generates code for the specified FieldDirection.

(Inherited from CodeGenerator)
OutputExpressionList(CodeExpressionCollection, Boolean)

Generates code for the specified expression list.

(Inherited from CodeGenerator)
OutputExpressionList(CodeExpressionCollection)

Generates code for the specified expression list.

(Inherited from CodeGenerator)
OutputFieldScopeModifier(MemberAttributes)

Outputs a field scope modifier that corresponds to the specified attributes.

(Inherited from CodeGenerator)
OutputIdentifier(String)

Outputs the specified identifier.

(Inherited from CodeGenerator)
OutputMemberAccessModifier(MemberAttributes)

Generates code for the specified member access modifier.

(Inherited from CodeGenerator)
OutputMemberScopeModifier(MemberAttributes)

Generates code for the specified member scope modifier.

(Inherited from CodeGenerator)
OutputOperator(CodeBinaryOperatorType)

Generates code for the specified operator.

(Inherited from CodeGenerator)
OutputParameters(CodeParameterDeclarationExpressionCollection)

Generates code for the specified parameters.

(Inherited from CodeGenerator)
OutputType(CodeTypeReference)

Generates code for the specified type.

(Inherited from CodeGenerator)
OutputTypeAttributes(TypeAttributes, Boolean, Boolean)

Generates code for the specified type attributes.

(Inherited from CodeGenerator)
OutputTypeNamePair(CodeTypeReference, String)

Generates code for the specified object type and name pair.

(Inherited from CodeGenerator)
ProcessCompilerOutputLine(CompilerResults, String)

Processes the specified line from the specified CompilerResults.

QuoteSnippetString(String)

Converts the specified string by formatting it with escape codes.

(Inherited from CodeGenerator)
Supports(GeneratorSupport)

Gets a value indicating whether the specified code generation support is provided.

(Inherited from CodeGenerator)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
ValidateIdentifier(String)

Throws an exception if the specified string is not a valid identifier.

(Inherited from CodeGenerator)

Explicit Interface Implementations

ICodeCompiler.CompileAssemblyFromDom(CompilerParameters, CodeCompileUnit)

For a description of this member, see CompileAssemblyFromDom(CompilerParameters, CodeCompileUnit).

ICodeCompiler.CompileAssemblyFromDomBatch(CompilerParameters, CodeCompileUnit[])

For a description of this member, see CompileAssemblyFromDomBatch(CompilerParameters, CodeCompileUnit[]).

ICodeCompiler.CompileAssemblyFromFile(CompilerParameters, String)

For a description of this member, see CompileAssemblyFromFile(CompilerParameters, String).

ICodeCompiler.CompileAssemblyFromFileBatch(CompilerParameters, String[])

For a description of this member, see CompileAssemblyFromFileBatch(CompilerParameters, String[]).

ICodeCompiler.CompileAssemblyFromSource(CompilerParameters, String)

For a description of this member, see CompileAssemblyFromSource(CompilerParameters, String).

ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters, String[])

For a description of this member, see CompileAssemblyFromSourceBatch(CompilerParameters, String[]).

ICodeGenerator.CreateEscapedIdentifier(String)

Creates an escaped identifier for the specified value.

(Inherited from CodeGenerator)
ICodeGenerator.CreateValidIdentifier(String)

Creates a valid identifier for the specified value.

(Inherited from CodeGenerator)
ICodeGenerator.GenerateCodeFromCompileUnit(CodeCompileUnit, TextWriter, CodeGeneratorOptions)

Generates code for the specified Code Document Object Model (CodeDOM) compilation unit and outputs it to the specified text writer using the specified options.

(Inherited from CodeGenerator)
ICodeGenerator.GenerateCodeFromExpression(CodeExpression, TextWriter, CodeGeneratorOptions)

Generates code for the specified Code Document Object Model (CodeDOM) expression and outputs it to the specified text writer.

(Inherited from CodeGenerator)
ICodeGenerator.GenerateCodeFromNamespace(CodeNamespace, TextWriter, CodeGeneratorOptions)

Generates code for the specified Code Document Object Model (CodeDOM) namespace and outputs it to the specified text writer using the specified options.

(Inherited from CodeGenerator)
ICodeGenerator.GenerateCodeFromStatement(CodeStatement, TextWriter, CodeGeneratorOptions)

Generates code for the specified Code Document Object Model (CodeDOM) statement and outputs it to the specified text writer using the specified options.

(Inherited from CodeGenerator)
ICodeGenerator.GenerateCodeFromType(CodeTypeDeclaration, TextWriter, CodeGeneratorOptions)

Generates code for the specified Code Document Object Model (CodeDOM) type declaration and outputs it to the specified text writer using the specified options.

(Inherited from CodeGenerator)
ICodeGenerator.GetTypeOutput(CodeTypeReference)

Gets the type indicated by the specified CodeTypeReference.

(Inherited from CodeGenerator)
ICodeGenerator.IsValidIdentifier(String)

Gets a value that indicates whether the specified value is a valid identifier for the current language.

(Inherited from CodeGenerator)
ICodeGenerator.Supports(GeneratorSupport)

Gets a value indicating whether the generator provides support for the language features represented by the specified GeneratorSupport object.

(Inherited from CodeGenerator)
ICodeGenerator.ValidateIdentifier(String)

Throws an exception if the specified value is not a valid identifier.

(Inherited from CodeGenerator)

Applies to

See also