CodeClass2 Interface

 

Represents a class in source code.

Namespace:   EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

[GuidAttribute("295ADCD4-B052-49EE-934E-C6B36862A7C6")]
public interface CodeClass2 : CodeClass

NameDescription
System_CAPS_pubpropertyAccess

Sets or gets the access attributes of this code class.

System_CAPS_pubpropertyAttributes

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

System_CAPS_pubpropertyBases

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

System_CAPS_pubpropertyChildren

Gets a collection of objects contained within this code class.

System_CAPS_pubpropertyClassKind

This API supports the product infrastructure and is not intended to be used directly from your code. Microsoft Internal Use Only.

System_CAPS_pubpropertyCollection

Gets the collection contained within the code class.

System_CAPS_pubpropertyComment

Sets or gets the comment associated with the code class.

System_CAPS_pubpropertyDataTypeKind

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

System_CAPS_pubpropertyDerivedTypes

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

System_CAPS_pubpropertyDocComment

Gets or sets the document comment for the code class.

System_CAPS_pubpropertyDTE

Gets the top-level extensibility object.

System_CAPS_pubpropertyEndPoint

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

System_CAPS_pubpropertyExtender[String]

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

System_CAPS_pubpropertyExtenderCATID

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

System_CAPS_pubpropertyExtenderNames

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

System_CAPS_pubpropertyFullName

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

System_CAPS_pubpropertyImplementedInterfaces

Gets a collection of interfaces implemented by the code class.

System_CAPS_pubpropertyInfoLocation

Gets the capabilities of the code model.

System_CAPS_pubpropertyInheritanceKind

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

System_CAPS_pubpropertyIsAbstract

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

System_CAPS_pubpropertyIsCodeType

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

System_CAPS_pubpropertyIsDerivedFrom[String]

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

System_CAPS_pubpropertyIsGeneric

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

System_CAPS_pubpropertyIsShared

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

System_CAPS_pubpropertyKind

Gets an enumeration indicating the type of class.

System_CAPS_pubpropertyLanguage

Gets the programming language used to author the class.

System_CAPS_pubpropertyMembers

Gets a collection of code elements contained by the class.

System_CAPS_pubpropertyName

Sets or gets the name of the class.

System_CAPS_pubpropertyNamespace

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

System_CAPS_pubpropertyParent

Gets the immediate parent object of the class.

System_CAPS_pubpropertyPartialClasses

This API supports the product infrastructure and is not intended to be used directly from your code. Microsoft Internal Use Only.

System_CAPS_pubpropertyParts

Gets parts of a class.

System_CAPS_pubpropertyProjectItem

Gets the ProjectItem associated with the given object.

System_CAPS_pubpropertyStartPoint

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

NameDescription
System_CAPS_pubmethodAddAttribute(String, String, Object)

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

System_CAPS_pubmethodAddBase(Object, Object)

Adds an item to the list of inherited objects.

System_CAPS_pubmethodAddClass(String, Object, Object, Object, vsCMAccess)

Creates a new class in the specified code class.

System_CAPS_pubmethodAddDelegate(String, Object, Object, vsCMAccess)

Creates a new delegate in the specified class.

System_CAPS_pubmethodAddEnum(String, Object, Object, vsCMAccess)

Creates a new enumeration in the class.

System_CAPS_pubmethodAddEvent(String, String, Boolean, Object, vsCMAccess)

Adds a class event.

System_CAPS_pubmethodAddFunction(String, vsCMFunction, Object, Object, vsCMAccess, Object)

Creates a new function in the class.

System_CAPS_pubmethodAddImplementedInterface(Object, Object)

Adds an interface to the list of inherited objects.

System_CAPS_pubmethodAddProperty(String, String, Object, Object, vsCMAccess, Object)

Creates a new property construct in the class.

System_CAPS_pubmethodAddStruct(String, Object, Object, Object, vsCMAccess)

Creates a new structure in the class.

System_CAPS_pubmethodAddVariable(String, Object, Object, vsCMAccess, Object)

Creates a new variable in the class.

System_CAPS_pubmethodGetEndPoint(vsCMPart)

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

System_CAPS_pubmethodGetStartPoint(vsCMPart)

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

System_CAPS_pubmethodRemoveBase(Object)

Removes an object from the list of bases.

System_CAPS_pubmethodRemoveInterface(Object)

Removes an interface from the list of implemented interfaces.

System_CAPS_pubmethodRemoveMember(Object)

Removes a member of the class.

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.

System_CAPS_noteNote

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).

[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
Return to top
Show: