Partager via


VCCodeVariable.IsInjected Property

Definition

Gets if a code element has been injected by an attribute.

public:
 property bool IsInjected { bool get(); };
public:
 property bool IsInjected { bool get(); };
[System.Runtime.InteropServices.DispId(547)]
public bool IsInjected { [System.Runtime.InteropServices.DispId(547)] get; }
[<System.Runtime.InteropServices.DispId(547)>]
[<get: System.Runtime.InteropServices.DispId(547)>]
member this.IsInjected : bool
Public ReadOnly Property IsInjected As Boolean

Property Value

true if this element was automatically generated by an attribute; otherwise, false.

Attributes

Examples

This example iterates through all global VCCodeElement objects in a file and displays the names of those objects injected by attribute or macro expansions.

Sub InjectedObjects()  
    Dim vcCM As VCCodeModel  
    Dim vcCodeElement As VCCodeElement  
    vcCM = DTE.Solution.Item(1).CodeModel  
    For Each vcCodeElement In vcCM.CodeElements  
        If (vcCodeElement.IsInjected) Then  
            MsgBox(vcCodeElement.Name + " was injected.")  
        End If  
    Next  
End Sub  

Remarks

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

Applies to