Expressions.Item(Object) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Returns a Expression object in a Expressions collection.
public:
EnvDTE::Expression ^ Item(System::Object ^ index);
public:
EnvDTE::Expression ^ Item(Platform::Object ^ index);
EnvDTE::Expression Item(winrt::Windows::Foundation::IInspectable const & index);
[System.Runtime.InteropServices.DispId(0)]
public EnvDTE.Expression Item (object index);
[<System.Runtime.InteropServices.DispId(0)>]
abstract member Item : obj -> EnvDTE.Expression
Public Function Item (index As Object) As Expression
Parameters
- index
- Object
Required. The index of the Expression object to return.
Returns
An Expression object.
- Attributes
Examples
The following example demonstrates how to use the Item method.
public static void Item(DTE dte)
{
// Setup debug Output window.
Window w = (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
w.Visible = true;
OutputWindow ow = (OutputWindow)w.Object;
OutputWindowPane owp = ow.OutputWindowPanes.Add("Item Method Test");
owp.Activate();
EnvDTE.Expression exp = dte.Debugger.GetExpression("a", true, 1);
EnvDTE.Expressions exps = exp.DataMembers;
owp.OutputString("\nExpression count: " + exps.Count);
owp.OutputString("\nEdition of the environment: " + exps.DTE.Edition);
owp.OutputString("\nThe name of the current program: " +
exps.Parent.CurrentProgram.Name);
owp.OutputString("\nSecond expression: " + exps.Item(2).Name);
}
Shared Sub Item(ByRef dte As EnvDTE.DTE)
Dim exp As EnvDTE.Expression = dte.Debugger.GetExpression("a", True, 1)
Dim exps As EnvDTE.Expressions = exp.DataMembers
Dim str As String = vbCrLf
str = "Expression count: " + exps.Count.ToString()
str += vbCrLf + "Edition of the environment: " + exps.DTE.Edition
str += vbCrLf + "The name of the current program: " + _
exps.Parent.CurrentProgram.Name
str += vbCrLf + "Second expression: " + exps.Item(2).Name
MessageBox.Show(str, "Expression Test - Expressions Properties")
End Sub
Remarks
The Item method throws a System.ArgumentException
exception if the collection cannot find the object that corresponds to the index value.