Languages.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.
public:
EnvDTE::Language ^ Item(System::Object ^ index);
public:
EnvDTE::Language ^ Item(Platform::Object ^ index);
EnvDTE::Language Item(winrt::Windows::Foundation::IInspectable const & index);
[System.Runtime.InteropServices.DispId(0)]
public EnvDTE.Language Item (object index);
[<System.Runtime.InteropServices.DispId(0)>]
abstract member Item : obj -> EnvDTE.Language
Public Function Item (index As Object) As Language
Parameters
Returns
A Language 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.Languages languages = dte.Debugger.Languages;
owp.OutputString("\nEdition of the environment: " + languages.DTE.Edition);
owp.OutputString("\nThird language in the language collection: " +
languages.Item(3).Name);
owp.OutputString("\nThe name of the current program: " +
languages.Parent.CurrentProgram.Name);
}
Shared Sub Item(ByRef dte As EnvDTE.DTE)
Dim languages As EnvDTE.Languages = dte.Debugger.Languages
Dim str As String = vbCrLf
str = "Edition of the environment: " + languages.DTE.Edition
str += vbCrLf + vbCrLf + "Third language in the language collection: "
str += languages.Item(3).Name
str += vbCrLf + vbCrLf + "The name of the current program: " + _
languages.Parent.CurrentProgram.Name
MessageBox.Show(str, "Language Test - Item Method")
End Sub
Remarks
The Item method throws a System.ArgumentException
exception if the collection cannot find the object that corresponds to the index value.