CodeElements 介面

定義

代表原始程式檔中程式碼建構的物件集合。A collection of objects representing code constructs in a source file.

public interface class CodeElements : System::Collections::IEnumerable
[System.Runtime.InteropServices.Guid("0CFBC2B5-0D4E-11D3-8997-00C04F688DDE")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface CodeElements : System.Collections.IEnumerable
[<System.Runtime.InteropServices.Guid("0CFBC2B5-0D4E-11D3-8997-00C04F688DDE")>]
[<System.Runtime.InteropServices.TypeLibType(4160)>]
type CodeElements = interface
    interface IEnumerable
Public Interface CodeElements
Implements IEnumerable
衍生
屬性
實作

備註

CodeElements 包含原始程式檔中的所有元素、類別的成員等等。CodeElements contains all elements in source files, members of classes, and so forth. 如果在開啟的檔中加入或移除專案,或透過程式碼模型,則會自動更新。It is automatically updated if an item is added to or removed from an open document or through the code model.

您可以使用來流覽程式碼元素 ProjectItem.FileCodeModel.CodeElementsYou can navigate through code elements using ProjectItem.FileCodeModel.CodeElements.

注意

像是類別、結構、函式、屬性、委派等程式碼模型項目的值,在執行特定類型的編輯後,可能會不具決定性,這表示它們的值不能指望會一律保持相同。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. 如需詳細資訊,請參閱程式碼模型專案值在 使用程式碼模型探索程式碼時可能會變更 (Visual Basic) For more information, see the section Code Model Element Values Can Change in Discovering Code by Using the Code Model (Visual Basic).

屬性

Count

取得值,指出集合中的物件數目 CodeElementsGets a value indicating the number of objects in the CodeElements collection.

DTE

取得最上層的擴充性物件。Gets the top-level extensibility object.

Parent

取得集合的直屬父物件 CodeElementsGets the immediate parent object of a CodeElements collection.

方法

CreateUniqueID(String, String)

建立程式設計的識別碼,此識別碼不會與範圍中的其他識別碼衝突,並遵循目前的語言命名規則。Creates a programmatic identifier that does not collide with other identifiers in the scope and that follows the current language naming rules.

GetEnumerator()

傳回集合中專案的列舉值 CodeElementsReturns an enumerator for items in the CodeElements collection.

Item(Object)

傳回 CodeElement 集合中的物件 CodeElementsReturns a CodeElement object in a CodeElements collection.

Reserved1(Object)

僅供 Microsoft 內部使用。Microsoft Internal Use Only.

適用於