Partager via


VCCodeAttribute Interface

Provides access to an item attribute.

Namespace:  Microsoft.VisualStudio.VCCodeModel
Assembly:  Microsoft.VisualStudio.VCCodeModel (in Microsoft.VisualStudio.VCCodeModel.dll)

Syntax

<GuidAttribute("17730D44-271F-11D7-8BF6-00B0D03DAA06")> _
Public Interface VCCodeAttribute

Dim instance As VCCodeAttribute
[GuidAttribute("17730D44-271F-11D7-8BF6-00B0D03DAA06")]
public interface VCCodeAttribute
[GuidAttribute(L"17730D44-271F-11D7-8BF6-00B0D03DAA06")]
public interface class VCCodeAttribute
public interface VCCodeAttribute

Remarks

The VCCodeAttribute object represents either a CLR or COM metadata attribute associated with a code element. You can add new parameters to the attribute with the AddParameter method and get and set the value of a code attribute with the VCCodeAttribute object.

Notes

A large part of the functionality of this object is provided by the Visual Studio VCCodeAttribute object. For more information, see CodeAttribute object.

Examples

This example displays the names of all attributes applied to the ATLProjectLib library. It is assumed that the ATLProjectLib library exists.

    Sub GetAttributes()
        Dim vcCM As VCCodeModel
        Dim vcLibrary As VCCodeIDLLibrary
        Dim vcAttribute As VCCodeAttribute
        Dim i As Integer
        vcCM = DTE.Solution.Item(1).CodeModel
        vcLibrary = vcCM.IDLLibraries.Find("ATLProjectLib")
        For i = 1 To vcLibrary.Attributes.Count
            vcAttribute = vcLibrary.Attributes.Item(i)
            MsgBox(vcAttribute.DisplayName)
        Next
    End Sub

See How to: Compile Example Code for Visual C++ Code Model Extensibility for information on how to compile and run this sample.

See Also

Reference

VCCodeAttribute Members

Microsoft.VisualStudio.VCCodeModel Namespace