次の方法で共有


CodeClass2 Interface

Definition

Represents a class in source code.

public interface class CodeClass2 : EnvDTE::CodeClass
public interface class CodeClass2 : EnvDTE::CodeClass
__interface CodeClass2 : EnvDTE::CodeClass
[System.Runtime.InteropServices.Guid("295ADCD4-B052-49EE-934E-C6B36862A7C6")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface CodeClass2 : EnvDTE.CodeClass
[<System.Runtime.InteropServices.Guid("295ADCD4-B052-49EE-934E-C6B36862A7C6")>]
[<System.Runtime.InteropServices.TypeLibType(4160)>]
type CodeClass2 = interface
    interface CodeClass
Public Interface CodeClass2
Implements CodeClass
Attributes
Implements

Examples

[Visual Basic]

Sub CodeClass2Example()  
    ' Iterates through the main class and  
    ' lists its parts.  
    Dim sel As TextSelection  
    Dim myClass1 As EnvDTE80.CodeClass2  
    Dim classPart As EnvDTE80.CodeClass2  

    sel = applicationObject.ActiveDocument.Selection  
    myClass1 = sel.ActivePoint.CodeElement _  
    (vsCMElement.vsCMElementClass)  
    If myClass1.ClassKind = _  
    vsCMClassKind.vsCMClassKindMainClass Then  
        For Each classPart In myClass1.Collection  
            MsgBox(classPart.Name)  
        Next  
    End If  
End Sub  

Remarks

With the introduction of blueprints and partial classes, there may be more than one CodeClass object per class that gets compiled. There is one instance of a CodeClass object for each class contained in a file. The CodeClass2 object can determine if it represents a partial or complete class, and whether it is implemented as an XML blueprint or as code. Edits or additions to the CodeClass2 object may only be written into this portion (and file) of the class.

Note

The values of code model elements such as classes, structs, functions, attributes, delegates, and so forth can be non-deterministic after making certain kinds of edits, meaning that their values cannot be relied upon to always remain the same. For more information, see the section Code Model Element Values Can Change in Discovering Code by Using the Code Model (Visual Basic).

Properties

Access

Sets or gets the access attributes of this code class.

Attributes

Gets a collection of all of the attributes for the code class.

Bases

Gets a collection of classes from which this code class derives.

Children

Gets a collection of objects contained within this code class.

ClassKind

Microsoft Internal Use Only.

Collection

Gets the collection contained within the code class.

Comment

Sets or gets the comment associated with the code class.

DataTypeKind

Sets of gets the relationship of this class with other classes.

DerivedTypes

Gets a collection of objects derived from the code class. Not implemented in Visual C#.

DocComment

Gets or sets the document comment for the code class.

DTE

Gets the top-level extensibility object.

EndPoint

Gets the edit point that is the location of the end of the code class.

Extender[String]

Returns the requested Extender object if it is available for the code class. Not implemented in Visual C#.

ExtenderCATID

Gets the Extender category ID (CATID) for the code class. Not implemented in Visual C#.

ExtenderNames

Gets a list of available Extenders for the code class. Not implemented in Visual C#.

FullName

Gets the full path and name of the file of the code class.

ImplementedInterfaces

Gets a collection of interfaces implemented by the code class.

InfoLocation

Gets the capabilities of the code model.

InheritanceKind

Gets or sets a value indicating whether a class may be used to create a new class.

IsAbstract

Sets or gets whether or not the code class is declared as abstract.

IsCodeType

Gets a value indicating whether a CodeType object can be obtained from the code class.

IsDerivedFrom[String]

Gets a value indicating whether the code class has another code class as its base.

IsGeneric

Gets a value indicating whether the current class or struct is a generic.

IsShared

Gets or sets the shared (static) status of the class.

Kind

Gets an enumeration indicating the type of class.

Language

Gets the programming language used to author the class.

Members

Gets a collection of code elements contained by the class.

Name

Sets or gets the name of the class.

Namespace

Gets a CodeNamespace object defining the parent namespace of the class.

Parent

Gets the immediate parent object of the class.

PartialClasses

Microsoft Internal Use Only.

Parts

Gets parts of a class.

ProjectItem

Gets the ProjectItem associated with the given object.

StartPoint

Gets a TextPoint object that defines the beginning of the class.

Methods

AddAttribute(String, String, Object)

Creates a new attribute code construct and inserts the class in the correct location.

AddBase(Object, Object)

Adds an item to the list of inherited objects.

AddClass(String, Object, Object, Object, vsCMAccess)

Creates a new class in the specified code class.

AddDelegate(String, Object, Object, vsCMAccess)

Creates a new delegate in the specified class.

AddEnum(String, Object, Object, vsCMAccess)

Creates a new enumeration in the class.

AddEvent(String, String, Boolean, Object, vsCMAccess)

Adds a class event.

AddFunction(String, vsCMFunction, Object, Object, vsCMAccess, Object)

Creates a new function in the class.

AddImplementedInterface(Object, Object)

Adds an interface to the list of inherited objects.

AddProperty(String, String, Object, Object, vsCMAccess, Object)

Creates a new property construct in the class.

AddStruct(String, Object, Object, Object, vsCMAccess)

Creates a new structure in the class.

AddVariable(String, Object, Object, vsCMAccess, Object)

Creates a new variable in the class.

GetEndPoint(vsCMPart)

Gets a TextPoint object that marks the end of the class.

GetStartPoint(vsCMPart)

Gets a TextPoint object that defines the beginning of the class.

RemoveBase(Object)

Removes an object from the list of bases.

RemoveInterface(Object)

Removes an interface from the list of implemented interfaces.

RemoveMember(Object)

Removes a member of the class.

Applies to