System.CodeDom.CodeTypeConstructor Class

Assembly: System.dll
Namespace: System.CodeDom
Summary
Represents a static constructor for a class.
C# Syntax:
[Serializable]
public class CodeTypeConstructor : CodeMemberMethod
Remarks
CodeTypeConstructor can be used to represent the static constructor for a class. A static constructor is called once when the type is loaded.

Note Not all languages support static constructors. Support for static constructors can be checked by calling ICodeGenerator.Supports with the GeneratorSupport.StaticConstructors flag to determine if static constructors are supported by the code generator for a particular language.
See also:
System.CodeDom Namespace

System.CodeDom.CodeTypeConstructor Member List:

Public Constructors
ctor #1 Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Initializes a new instance of the CodeTypeConstructor class.
Public Properties
Attributes
(inherited from System.CodeDom.CodeTypeMember)
Read-write

See base class member description: System.CodeDom.CodeTypeMember.Attributes


Gets or sets the attributes of the member.
Comments
(inherited from System.CodeDom.CodeTypeMember)
Read-only

See base class member description: System.CodeDom.CodeTypeMember.Comments


Gets the comment collection for the type member.
CustomAttributes
(inherited from System.CodeDom.CodeTypeMember)
Read-write

See base class member description: System.CodeDom.CodeTypeMember.CustomAttributes


Gets or sets the custom attributes of the member.
ImplementationTypes
(inherited from System.CodeDom.CodeMemberMethod)
Read-only

See base class member description: System.CodeDom.CodeMemberMethod.ImplementationTypes


Gets the data types of the interfaces implemented by this method, unless it is a private method implementation, which is indicated by the CodeMemberMethod.PrivateImplementationType property.
LinePragma
(inherited from System.CodeDom.CodeTypeMember)
Read-write

See base class member description: System.CodeDom.CodeTypeMember.LinePragma


Gets or sets the line the statement occurs on.
Name
(inherited from System.CodeDom.CodeTypeMember)
Read-write

See base class member description: System.CodeDom.CodeTypeMember.Name


Gets or sets the name of the member.
Parameters
(inherited from System.CodeDom.CodeMemberMethod)
Read-only

See base class member description: System.CodeDom.CodeMemberMethod.Parameters


Gets the parameter declarations for the method.
PrivateImplementationType
(inherited from System.CodeDom.CodeMemberMethod)
Read-write

See base class member description: System.CodeDom.CodeMemberMethod.PrivateImplementationType


Gets or sets the data type of the interface this method, if private, implements a method of, if any.
ReturnType
(inherited from System.CodeDom.CodeMemberMethod)
Read-write

See base class member description: System.CodeDom.CodeMemberMethod.ReturnType


Gets or sets the data type of the return value of the method.
ReturnTypeCustomAttributes
(inherited from System.CodeDom.CodeMemberMethod)
Read-only

See base class member description: System.CodeDom.CodeMemberMethod.ReturnTypeCustomAttributes


Gets the custom attributes of the return type of the method.
Statements
(inherited from System.CodeDom.CodeMemberMethod)
Read-only

See base class member description: System.CodeDom.CodeMemberMethod.Statements


Gets the statements within the method.
UserData
(inherited from System.CodeDom.CodeObject)
Read-only

See base class member description: System.CodeDom.CodeObject.UserData


Gets or sets the user-definable data for the current object.
Public Methods
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Public Events
PopulateImplementationTypes
(inherited from System.CodeDom.CodeMemberMethod)
See base class member description: System.CodeDom.CodeMemberMethod.PopulateImplementationTypes


An event that will be raised the first time the CodeMemberMethod.ImplementationTypes collection is accessed.
PopulateParameters
(inherited from System.CodeDom.CodeMemberMethod)
See base class member description: System.CodeDom.CodeMemberMethod.PopulateParameters


An event that will be raised the first time the CodeMemberMethod.Parameters collection is accessed.
PopulateStatements
(inherited from System.CodeDom.CodeMemberMethod)
See base class member description: System.CodeDom.CodeMemberMethod.PopulateStatements


An event that will be raised the first time the CodeMemberMethod.Statements collection is accessed.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.CodeDom.CodeTypeConstructor Member Details

ctor #1
Summary
Initializes a new instance of the CodeTypeConstructor class.

Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public CodeTypeConstructor();

Return to top


Property: Attributes (read-write)
Inherited
See base class member description: System.CodeDom.CodeTypeMember.Attributes

Summary
Gets or sets the attributes of the member.
C# Syntax:
public MemberAttributes Attributes {get; set;}
Remarks
This property is used to specify attributes of the type member. Some types of attributes are Access (Public/Private) and Scope (Final/Override).
See also:
MemberAttributes

Return to top


Property: Comments (read-only)
Inherited
See base class member description: System.CodeDom.CodeTypeMember.Comments

Summary
Gets the comment collection for the type member.
C# Syntax:
public CodeCommentStatementCollection Comments {get;}
Remarks
Any comments in this collection will be written to the generated source file just before the declaration of the member.
See also:
CodeCommentStatementCollection

Return to top


Property: CustomAttributes (read-write)
Inherited
See base class member description: System.CodeDom.CodeTypeMember.CustomAttributes

Summary
Gets or sets the custom attributes of the member.
C# Syntax:
public CodeAttributeDeclarationCollection CustomAttributes {get; set;}
Remarks
This property can be used to add metadata attributes to the declaration of the member. This property is null by default and should be checked before referencing.
See also:
CodeAttributeDeclarationCollection

Return to top


Property: ImplementationTypes (read-only)
Inherited
See base class member description: System.CodeDom.CodeMemberMethod.ImplementationTypes

Summary
Gets the data types of the interfaces implemented by this method, unless it is a private method implementation, which is indicated by the CodeMemberMethod.PrivateImplementationType property.
C# Syntax:
public CodeTypeReferenceCollection ImplementationTypes {get;}
Remarks
The types referenced by this collection must consist of interfaces.

If this CodeMemberMethod represents a declaration for a public method, and this method implements a method on an interface, the interface or interfaces this method implements a method of should be referenced in this collection.

The method should still have the same name as the method of the interface that is implemented by this method. For some languages, like C#, this has no effect on the syntax. For others, like Visual Basic, there is a special syntax for implementing interfaces. If the method is privately implementing a single interface, the CodeMemberMethod.PrivateImplementationType property should be used instead.

Return to top


Property: LinePragma (read-write)
Inherited
See base class member description: System.CodeDom.CodeTypeMember.LinePragma

Summary
Gets or sets the line the statement occurs on.
C# Syntax:
public CodeLinePragma LinePragma {get; set;}
Remarks
This property indicates the location of the type member declaration. This property can be used for purposes of error reporting and debugging. This can be useful when code is generated based on a template file. This value is null by default and should be checked before referencing.
See also:
CodeLinePragma

Return to top


Property: Name (read-write)
Inherited
See base class member description: System.CodeDom.CodeTypeMember.Name

Summary
Gets or sets the name of the member.
C# Syntax:
public string Name {get; set;}

Return to top


Property: Parameters (read-only)
Inherited
See base class member description: System.CodeDom.CodeMemberMethod.Parameters

Summary
Gets the parameter declarations for the method.
C# Syntax:
public CodeParameterDeclarationExpressionCollection Parameters {get;}
See also:
CodeParameterDeclarationExpressionCollection

Return to top


Property: PrivateImplementationType (read-write)
Inherited
See base class member description: System.CodeDom.CodeMemberMethod.PrivateImplementationType

Summary
Gets or sets the data type of the interface this method, if private, implements a method of, if any.
C# Syntax:
public CodeTypeReference PrivateImplementationType {get; set;}
Remarks
If this CodeMemberMethod represents the declaration of a private method and the method implements a method of an interface, this property should indicate the interface type that the method is implementing a method of.

The type referenced by this property must be an interface.

Return to top


Property: ReturnType (read-write)
Inherited
See base class member description: System.CodeDom.CodeMemberMethod.ReturnType

Summary
Gets or sets the data type of the return value of the method.
C# Syntax:
public CodeTypeReference ReturnType {get; set;}

Return to top


Property: ReturnTypeCustomAttributes (read-only)
Inherited
See base class member description: System.CodeDom.CodeMemberMethod.ReturnTypeCustomAttributes

Summary
Gets the custom attributes of the return type of the method.
C# Syntax:
public CodeAttributeDeclarationCollection ReturnTypeCustomAttributes {get;}

Return to top


Property: Statements (read-only)
Inherited
See base class member description: System.CodeDom.CodeMemberMethod.Statements

Summary
Gets the statements within the method.
C# Syntax:
public CodeStatementCollection Statements {get;}
See also:
CodeStatementCollection

Return to top


Property: UserData (read-only)
Inherited
See base class member description: System.CodeDom.CodeObject.UserData

Summary
Gets or sets the user-definable data for the current object.
C# Syntax:
public IDictionary UserData {get;}
Remarks


Notes to inheritors: An inheritor can design the way this user data is stored, retrieved, and used.

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~CodeTypeConstructor();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Event: PopulateImplementationTypes
Inherited
See base class member description: System.CodeDom.CodeMemberMethod.PopulateImplementationTypes

Summary
An event that will be raised the first time the CodeMemberMethod.ImplementationTypes collection is accessed.
C# Syntax:
public event EventHandler PopulateImplementationTypes;

Return to top


Event: PopulateParameters
Inherited
See base class member description: System.CodeDom.CodeMemberMethod.PopulateParameters

Summary
An event that will be raised the first time the CodeMemberMethod.Parameters collection is accessed.
C# Syntax:
public event EventHandler PopulateParameters;

Return to top


Event: PopulateStatements
Inherited
See base class member description: System.CodeDom.CodeMemberMethod.PopulateStatements

Summary
An event that will be raised the first time the CodeMemberMethod.Statements collection is accessed.
C# Syntax:
public event EventHandler PopulateStatements;

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.