共用方式為


CodeAttributeArgument Interface

Definition

Represents a single argument (name/value pair) in a code attribute.

public interface class CodeAttributeArgument
public interface class CodeAttributeArgument
__interface CodeAttributeArgument
[System.Runtime.InteropServices.Guid("80F4779B-835D-4873-8356-2F34A759A514")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface CodeAttributeArgument
[<System.Runtime.InteropServices.Guid("80F4779B-835D-4873-8356-2F34A759A514")>]
[<System.Runtime.InteropServices.TypeLibType(4160)>]
type CodeAttributeArgument = interface
Public Interface CodeAttributeArgument
Attributes

Examples

' Macro code.  
Sub codeArgExample()  
    Dim sel As TextSelection = _  
    CType(DTE.ActiveDocument.Selection, TextSelection)  
    Dim cls As CodeClass2 = CType(sel.ActivePoint. _  
    CodeElement(vsCMElement.vsCMElementClass), CodeClass2)  
    Dim attr As CodeAttribute2  
    Dim attrArg As CodeAttributeArgument  
    Dim msg As String  

    ' Loop through all of the attributes in the class.  
    For Each attr In cls.Attributes  
        ' Loop through all of the arguments for the attribute.  
        For Each attrArg In attr.Arguments  
            msg += attrArg.Value & " "  
        Next  
    Next  
    ' List the arguments for the attribute.  
    MsgBox("Attribute parameters for " & attr.Name _  
    & ": " & msg)  
End Sub  

Remarks

All arguments for a code attribute are contained in the Collection property.

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

Children

Gets the collection of child attributes for the specified code attribute argument.

Collection

Gets the collection containing the object that supports this property.

DTE

Gets the top-level extensibility object, in this case the DTE2 object.

EndPoint

Gets a TextPoint object defining the end of the code attribute argument.

Extender[String]

Returns the Extender for the code attribute argument.

ExtenderCATID

Gets the category ID (CATID) for the Extender of the code attribute argument.

ExtenderNames

Gets the names of the Extenders for the code attribute arguments.

FullName

Gets the fully qualified name of the code attribute argument's definition.

InfoLocation

Gets a constant indicating the location of the code attribute argument.

IsCodeType

Gets a value indicating whether a CodeType object can be obtained from this code attribute argument.

Kind

Gets an enumeration value that defines the type of code element.

Language

Gets the programming language that is used to author the code.

Name

Gets or sets a string representing the name of the object.

ProjectItem

Gets the associated ProjectItem object.

StartPoint

Gets a TextPoint object defining the start of the code attribute argument.

Value

Sets or gets the value of an attribute argument.

Methods

Delete()

Removes a single argument from a code attribute.

GetEndPoint(vsCMPart)

Returns a TextPoint object that marks the end of the attribute argument.

GetStartPoint(vsCMPart)

Gets a TextPoint object that marks the start of the attribute argument.

Applies to