共用方式為


VCCodeModel.CodeElementFromFullName(String) Method

Definition

Gets a collection of the specified code elements for the object.

public:
 EnvDTE::CodeElements ^ CodeElementFromFullName(System::String ^ Name);
[System.Runtime.InteropServices.DispId(518)]
public EnvDTE.CodeElements CodeElementFromFullName (string Name);
[<System.Runtime.InteropServices.DispId(518)>]
abstract member CodeElementFromFullName : string -> EnvDTE.CodeElements
Public Function CodeElementFromFullName (Name As String) As CodeElements

Parameters

Name
String

Required. The full name of the elements to retrieve.

Returns

A CodeElements collection.

Attributes

Examples

This example adds a class and a function, retrieves a pointer to the function by using CodeElementFromFullName, and adds a parameter to it.

Sub AddFunction()  
    Dim vcCM As VCCodeModel  
    Dim vcClass As VCCodeClass  
    Dim vcFunction As VCCodeFunction  
    Dim vcParameter As VCCodeParameter  
    vcCM = DTE.Solution.Item(1).CodeModel  
    vcClass = vcCM.AddClass("MyClass", "MyClass.h")  
    vcClass.AddFunction("MyFunction", vsCMFunction.vsCMFunctionFunction, "int")  
    vcFunction = vcCM.CodeElementFromFullName("MyClass::MyFunction").Item(1)  
    vcParameter = vcFunction.AddParameter("MyParameter", "int")  
End Sub  

Applies to