Partager via


CodeModel2.ElementFromID(String) Method

Definition

Returns a specific, existing code element.

public:
 EnvDTE::CodeElement ^ ElementFromID(System::String ^ ID);
public:
 EnvDTE::CodeElement ^ ElementFromID(Platform::String ^ ID);
EnvDTE::CodeElement ElementFromID(std::wstring const & ID);
[System.Runtime.InteropServices.DispId(203)]
public EnvDTE.CodeElement ElementFromID (string ID);
[<System.Runtime.InteropServices.DispId(203)>]
abstract member ElementFromID : string -> EnvDTE.CodeElement
Public Function ElementFromID (ID As String) As CodeElement

Parameters

ID
String

The name of the element.

Returns

A CodeElement object.

Attributes

Remarks

If the requested element no longer exists, the method should return E_FAIL.

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.

Applies to