Export (0) Print
Expand All

CodeCompiler Class

Provides an example implementation of the ICodeCompiler interface.

Namespace:  System.CodeDom.Compiler
Assembly:  System (in System.dll)

[PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public abstract class CodeCompiler : CodeGenerator, 
	ICodeCompiler

The CodeCompiler type exposes the following members.

  NameDescription
Protected methodCodeCompilerInitializes a new instance of the CodeCompiler class.
Top

  NameDescription
Protected propertyCompilerNameGets the name of the compiler executable.
Protected propertyCurrentClassGets the code type declaration for the current class. (Inherited from CodeGenerator.)
Protected propertyCurrentMemberGets the current member of the class. (Inherited from CodeGenerator.)
Protected propertyCurrentMemberNameGets the current member name. (Inherited from CodeGenerator.)
Protected propertyCurrentTypeNameGets the current class name. (Inherited from CodeGenerator.)
Protected propertyFileExtensionGets the file name extension to use for source files.
Protected propertyIndentGets or sets the amount of spaces to indent each indentation level. (Inherited from CodeGenerator.)
Protected propertyIsCurrentClassGets a value indicating whether the current object being generated is a class. (Inherited from CodeGenerator.)
Protected propertyIsCurrentDelegateGets a value indicating whether the current object being generated is a delegate. (Inherited from CodeGenerator.)
Protected propertyIsCurrentEnumGets a value indicating whether the current object being generated is an enumeration. (Inherited from CodeGenerator.)
Protected propertyIsCurrentInterfaceGets a value indicating whether the current object being generated is an interface. (Inherited from CodeGenerator.)
Protected propertyIsCurrentStructGets a value indicating whether the current object being generated is a value type or struct. (Inherited from CodeGenerator.)
Protected propertyNullTokenGets the token that represents null. (Inherited from CodeGenerator.)
Protected propertyOptionsGets the options to be used by the code generator. (Inherited from CodeGenerator.)
Protected propertyOutputGets the text writer to use for output. (Inherited from CodeGenerator.)
Top

  NameDescription
Protected methodCmdArgsFromParametersGets the command arguments to be passed to the compiler from the specified CompilerParameters.
Protected methodContinueOnNewLineGenerates a line-continuation character and outputs the specified string on a new line. (Inherited from CodeGenerator.)
Protected methodCreateEscapedIdentifierCreates an escaped identifier for the specified value. (Inherited from CodeGenerator.)
Protected methodCreateValidIdentifierCreates a valid identifier for the specified value. (Inherited from CodeGenerator.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Protected methodFromDomCompiles the specified compile unit using the specified options, and returns the results from the compilation.
Protected methodFromDomBatchCompiles the specified compile units using the specified options, and returns the results from the compilation.
Protected methodFromFileCompiles the specified file using the specified options, and returns the results from the compilation.
Protected methodFromFileBatchCompiles the specified files using the specified options, and returns the results from the compilation.
Protected methodFromSourceCompiles the specified source code string using the specified options, and returns the results from the compilation.
Protected methodFromSourceBatchCompiles the specified source code strings using the specified options, and returns the results from the compilation.
Protected methodGenerateArgumentReferenceExpressionGenerates code for the specified argument reference expression. (Inherited from CodeGenerator.)
Protected methodGenerateArrayCreateExpressionGenerates code for the specified array creation expression. (Inherited from CodeGenerator.)
Protected methodGenerateArrayIndexerExpressionGenerates code for the specified array indexer expression. (Inherited from CodeGenerator.)
Protected methodGenerateAssignStatementGenerates code for the specified assignment statement. (Inherited from CodeGenerator.)
Protected methodGenerateAttachEventStatementGenerates code for the specified attach event statement. (Inherited from CodeGenerator.)
Protected methodGenerateAttributeDeclarationsEndGenerates code for the specified attribute block end. (Inherited from CodeGenerator.)
Protected methodGenerateAttributeDeclarationsStartGenerates code for the specified attribute block start. (Inherited from CodeGenerator.)
Protected methodGenerateBaseReferenceExpressionGenerates code for the specified base reference expression. (Inherited from CodeGenerator.)
Protected methodGenerateBinaryOperatorExpressionGenerates code for the specified binary operator expression. (Inherited from CodeGenerator.)
Protected methodGenerateCastExpressionGenerates code for the specified cast expression. (Inherited from CodeGenerator.)
Public methodGenerateCodeFromMemberGenerates code for the specified class member using the specified text writer and code generator options. (Inherited from CodeGenerator.)
Protected methodGenerateCommentGenerates code for the specified comment. (Inherited from CodeGenerator.)
Protected methodGenerateCommentStatementGenerates code for the specified comment statement. (Inherited from CodeGenerator.)
Protected methodGenerateCommentStatementsGenerates code for the specified comment statements. (Inherited from CodeGenerator.)
Protected methodGenerateCompileUnitGenerates code for the specified compile unit. (Inherited from CodeGenerator.)
Protected methodGenerateCompileUnitEndGenerates code for the end of a compile unit. (Inherited from CodeGenerator.)
Protected methodGenerateCompileUnitStartGenerates code for the start of a compile unit. (Inherited from CodeGenerator.)
Protected methodGenerateConditionStatementGenerates code for the specified conditional statement. (Inherited from CodeGenerator.)
Protected methodGenerateConstructorGenerates code for the specified constructor. (Inherited from CodeGenerator.)
Protected methodGenerateDecimalValueGenerates code for the specified decimal value. (Inherited from CodeGenerator.)
Protected methodGenerateDefaultValueExpressionGenerates code for the specified reference to a default value. (Inherited from CodeGenerator.)
Protected methodGenerateDelegateCreateExpressionGenerates code for the specified delegate creation expression. (Inherited from CodeGenerator.)
Protected methodGenerateDelegateInvokeExpressionGenerates code for the specified delegate invoke expression. (Inherited from CodeGenerator.)
Protected methodGenerateDirectionExpressionGenerates code for the specified direction expression. (Inherited from CodeGenerator.)
Protected methodGenerateDirectivesGenerates code for the specified code directives. (Inherited from CodeGenerator.)
Protected methodGenerateDoubleValueGenerates code for a double-precision floating point number. (Inherited from CodeGenerator.)
Protected methodGenerateEntryPointMethodGenerates code for the specified entry point method. (Inherited from CodeGenerator.)
Protected methodGenerateEventGenerates code for the specified event. (Inherited from CodeGenerator.)
Protected methodGenerateEventReferenceExpressionGenerates code for the specified event reference expression. (Inherited from CodeGenerator.)
Protected methodGenerateExpressionGenerates code for the specified code expression. (Inherited from CodeGenerator.)
Protected methodGenerateExpressionStatementGenerates code for the specified expression statement. (Inherited from CodeGenerator.)
Protected methodGenerateFieldGenerates code for the specified member field. (Inherited from CodeGenerator.)
Protected methodGenerateFieldReferenceExpressionGenerates code for the specified field reference expression. (Inherited from CodeGenerator.)
Protected methodGenerateGotoStatementGenerates code for the specified goto statement. (Inherited from CodeGenerator.)
Protected methodGenerateIndexerExpressionGenerates code for the specified indexer expression. (Inherited from CodeGenerator.)
Protected methodGenerateIterationStatementGenerates code for the specified iteration statement. (Inherited from CodeGenerator.)
Protected methodGenerateLabeledStatementGenerates code for the specified labeled statement. (Inherited from CodeGenerator.)
Protected methodGenerateLinePragmaEndGenerates code for the specified line pragma end. (Inherited from CodeGenerator.)
Protected methodGenerateLinePragmaStartGenerates code for the specified line pragma start. (Inherited from CodeGenerator.)
Protected methodGenerateMethodGenerates code for the specified method. (Inherited from CodeGenerator.)
Protected methodGenerateMethodInvokeExpressionGenerates code for the specified method invoke expression. (Inherited from CodeGenerator.)
Protected methodGenerateMethodReferenceExpressionGenerates code for the specified method reference expression. (Inherited from CodeGenerator.)
Protected methodGenerateMethodReturnStatementGenerates code for the specified method return statement. (Inherited from CodeGenerator.)
Protected methodGenerateNamespaceGenerates code for the specified namespace. (Inherited from CodeGenerator.)
Protected methodGenerateNamespaceEndGenerates code for the end of a namespace. (Inherited from CodeGenerator.)
Protected methodGenerateNamespaceImportGenerates code for the specified namespace import. (Inherited from CodeGenerator.)
Protected methodGenerateNamespaceImportsGenerates code for the specified namespace import. (Inherited from CodeGenerator.)
Protected methodGenerateNamespacesGenerates code for the namespaces in the specified compile unit. (Inherited from CodeGenerator.)
Protected methodGenerateNamespaceStartGenerates code for the start of a namespace. (Inherited from CodeGenerator.)
Protected methodGenerateObjectCreateExpressionGenerates code for the specified object creation expression. (Inherited from CodeGenerator.)
Protected methodGenerateParameterDeclarationExpressionGenerates code for the specified parameter declaration expression. (Inherited from CodeGenerator.)
Protected methodGeneratePrimitiveExpressionGenerates code for the specified primitive expression. (Inherited from CodeGenerator.)
Protected methodGeneratePropertyGenerates code for the specified property. (Inherited from CodeGenerator.)
Protected methodGeneratePropertyReferenceExpressionGenerates code for the specified property reference expression. (Inherited from CodeGenerator.)
Protected methodGeneratePropertySetValueReferenceExpressionGenerates code for the specified property set value reference expression. (Inherited from CodeGenerator.)
Protected methodGenerateRemoveEventStatementGenerates code for the specified remove event statement. (Inherited from CodeGenerator.)
Protected methodGenerateSingleFloatValueGenerates code for a single-precision floating point number. (Inherited from CodeGenerator.)
Protected methodGenerateSnippetCompileUnitOutputs the code of the specified literal code fragment compile unit. (Inherited from CodeGenerator.)
Protected methodGenerateSnippetExpressionOutputs the code of the specified literal code fragment expression. (Inherited from CodeGenerator.)
Protected methodGenerateSnippetMemberOutputs the code of the specified literal code fragment class member. (Inherited from CodeGenerator.)
Protected methodGenerateSnippetStatementOutputs the code of the specified literal code fragment statement. (Inherited from CodeGenerator.)
Protected methodGenerateStatementGenerates code for the specified statement. (Inherited from CodeGenerator.)
Protected methodGenerateStatementsGenerates code for the specified statement collection. (Inherited from CodeGenerator.)
Protected methodGenerateThisReferenceExpressionGenerates code for the specified this reference expression. (Inherited from CodeGenerator.)
Protected methodGenerateThrowExceptionStatementGenerates code for the specified throw exception statement. (Inherited from CodeGenerator.)
Protected methodGenerateTryCatchFinallyStatementGenerates code for the specified try...catch...finally statement. (Inherited from CodeGenerator.)
Protected methodGenerateTypeConstructorGenerates code for the specified class constructor. (Inherited from CodeGenerator.)
Protected methodGenerateTypeEndGenerates code for the specified end of the class. (Inherited from CodeGenerator.)
Protected methodGenerateTypeOfExpressionGenerates code for the specified type of expression. (Inherited from CodeGenerator.)
Protected methodGenerateTypeReferenceExpressionGenerates code for the specified type reference expression. (Inherited from CodeGenerator.)
Protected methodGenerateTypesGenerates code for the specified namespace and the classes it contains. (Inherited from CodeGenerator.)
Protected methodGenerateTypeStartGenerates code for the specified start of the class. (Inherited from CodeGenerator.)
Protected methodGenerateVariableDeclarationStatementGenerates code for the specified variable declaration statement. (Inherited from CodeGenerator.)
Protected methodGenerateVariableReferenceExpressionGenerates code for the specified variable reference expression. (Inherited from CodeGenerator.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Protected methodGetResponseFileCmdArgsGets the command arguments to use when invoking the compiler to generate a response file.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodGetTypeOutputGets the name of the specified data type. (Inherited from CodeGenerator.)
Protected methodIsValidIdentifierGets a value indicating whether the specified value is a valid identifier. (Inherited from CodeGenerator.)
Protected methodStatic memberJoinStringArrayJoins the specified string arrays.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOutputAttributeArgumentOutputs an argument in an attribute block. (Inherited from CodeGenerator.)
Protected methodOutputAttributeDeclarationsGenerates code for the specified attribute declaration collection. (Inherited from CodeGenerator.)
Protected methodOutputDirectionGenerates code for the specified FieldDirection. (Inherited from CodeGenerator.)
Protected methodOutputExpressionList(CodeExpressionCollection)Generates code for the specified expression list. (Inherited from CodeGenerator.)
Protected methodOutputExpressionList(CodeExpressionCollection, Boolean)Generates code for the specified expression list. (Inherited from CodeGenerator.)
Protected methodOutputFieldScopeModifierOutputs a field scope modifier that corresponds to the specified attributes. (Inherited from CodeGenerator.)
Protected methodOutputIdentifierOutputs the specified identifier. (Inherited from CodeGenerator.)
Protected methodOutputMemberAccessModifierGenerates code for the specified member access modifier. (Inherited from CodeGenerator.)
Protected methodOutputMemberScopeModifierGenerates code for the specified member scope modifier. (Inherited from CodeGenerator.)
Protected methodOutputOperatorGenerates code for the specified operator. (Inherited from CodeGenerator.)
Protected methodOutputParametersGenerates code for the specified parameters. (Inherited from CodeGenerator.)
Protected methodOutputTypeGenerates code for the specified type. (Inherited from CodeGenerator.)
Protected methodOutputTypeAttributesGenerates code for the specified type attributes. (Inherited from CodeGenerator.)
Protected methodOutputTypeNamePairGenerates code for the specified object type and name pair. (Inherited from CodeGenerator.)
Protected methodProcessCompilerOutputLineProcesses the specified line from the specified CompilerResults.
Protected methodQuoteSnippetStringConverts the specified string by formatting it with escape codes. (Inherited from CodeGenerator.)
Protected methodSupportsGets a value indicating whether the specified code generation support is provided. (Inherited from CodeGenerator.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Protected methodValidateIdentifierThrows an exception if the specified string is not a valid identifier. (Inherited from CodeGenerator.)
Top

  NameDescription
Explicit interface implemetationPrivate methodICodeCompiler.CompileAssemblyFromDomInfrastructure. For a description of this member, see ICodeCompiler.CompileAssemblyFromDom.
Explicit interface implemetationPrivate methodICodeCompiler.CompileAssemblyFromDomBatchInfrastructure. For a description of this member, see ICodeCompiler.CompileAssemblyFromDomBatch.
Explicit interface implemetationPrivate methodICodeCompiler.CompileAssemblyFromFileInfrastructure. For a description of this member, see ICodeCompiler.CompileAssemblyFromFile.
Explicit interface implemetationPrivate methodICodeCompiler.CompileAssemblyFromFileBatchInfrastructure. For a description of this member, see ICodeCompiler.CompileAssemblyFromFileBatch.
Explicit interface implemetationPrivate methodICodeCompiler.CompileAssemblyFromSourceInfrastructure. For a description of this member, see ICodeCompiler.CompileAssemblyFromSource.
Explicit interface implemetationPrivate methodICodeCompiler.CompileAssemblyFromSourceBatchInfrastructure. For a description of this member, see ICodeCompiler.CompileAssemblyFromSourceBatch.
Explicit interface implemetationPrivate methodICodeGenerator.CreateEscapedIdentifierInfrastructure. Creates an escaped identifier for the specified value. (Inherited from CodeGenerator.)
Explicit interface implemetationPrivate methodICodeGenerator.CreateValidIdentifierInfrastructure. Creates a valid identifier for the specified value. (Inherited from CodeGenerator.)
Explicit interface implemetationPrivate methodICodeGenerator.GenerateCodeFromCompileUnitInfrastructure. 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.)
Explicit interface implemetationPrivate methodICodeGenerator.GenerateCodeFromExpressionInfrastructure. Generates code for the specified Code Document Object Model (CodeDOM) expression and outputs it to the specified text writer. (Inherited from CodeGenerator.)
Explicit interface implemetationPrivate methodICodeGenerator.GenerateCodeFromNamespaceInfrastructure. 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.)
Explicit interface implemetationPrivate methodICodeGenerator.GenerateCodeFromStatementInfrastructure. 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.)
Explicit interface implemetationPrivate methodICodeGenerator.GenerateCodeFromTypeInfrastructure. 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.)
Explicit interface implemetationPrivate methodICodeGenerator.GetTypeOutputInfrastructure. Gets the type indicated by the specified CodeTypeReference. (Inherited from CodeGenerator.)
Explicit interface implemetationPrivate methodICodeGenerator.IsValidIdentifierInfrastructure. Gets a value that indicates whether the specified value is a valid identifier for the current language. (Inherited from CodeGenerator.)
Explicit interface implemetationPrivate methodICodeGenerator.SupportsInfrastructure. Gets a value indicating whether the generator provides support for the language features represented by the specified GeneratorSupport object. (Inherited from CodeGenerator.)
Explicit interface implemetationPrivate methodICodeGenerator.ValidateIdentifierInfrastructure. Throws an exception if the specified value is not a valid identifier. (Inherited from CodeGenerator.)
Top

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

NoteNote

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

  • LinkDemand 

    for full trust for the immediate caller. This class cannot be used by partially trusted code.

  • InheritanceDemand 

    for full trust for inheritors. This class cannot be inherited by partially trusted code.

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft