Compartilhar via


Languages.Item Method

Returns a Language object in the Languages collection.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
Function Item ( _
    index As Object _
) As Language
Language Item(
    Object index
)
Language^ Item(
    [InAttribute] Object^ index
)
abstract Item : 
        index:Object -> Language
function Item(
    index : Object
) : Language

Parameters

Return Value

Type: EnvDTE.Language
A Language object.

Remarks

The Item method throws a System.ArgumentException exception if the collection cannot find the object that corresponds to the index value.

Examples

The following example demonstrates how to use the Item method.

To test this method:

  1. Set a breakpoint in your target application.

  2. Run the target application in the debug mode.

  3. When the application stops on the breakpoint, run the add-in.

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

.NET Framework Security

See Also

Reference

Languages Interface

EnvDTE Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples