Share via


FontsAndColorsItems.Item(Object) Method

Definition

Returns a ColorableItems object in a FontsAndColorsItems collection.

public:
 EnvDTE::ColorableItems ^ Item(System::Object ^ index);
public:
 EnvDTE::ColorableItems ^ Item(Platform::Object ^ index);
EnvDTE::ColorableItems Item(winrt::Windows::Foundation::IInspectable const & index);
[System.Runtime.InteropServices.DispId(0)]
public EnvDTE.ColorableItems Item (object index);
[<System.Runtime.InteropServices.DispId(0)>]
abstract member Item : obj -> EnvDTE.ColorableItems
Public Function Item (index As Object) As ColorableItems

Parameters

index
Object

Required. The index of the ColorableItems object to return.

Returns

A ColorableItems object.

Attributes

Examples

public void CodeExample(DTE2 dte)  
{   // Make sure you have an open solution  
    try  
    {  
        Properties props;  
        Property prop;  
        FontsAndColorsItems fci;  
        ColorableItems ci;  
        string msg = "";  
        props = dte.get_Properties("FontsAndColors", "TextEditor");  
        prop = props.Item("FontsAndColorsItems");  
        fci = (FontsAndColorsItems)prop.Object;  
        ci = fci.Item(1);  
        msg += "Count of ColorableItems in fci: " + fci.Count + "\n";  
        msg += "The first ColorableItems object in fci is " + ci.Name;  
        MessageBox.Show(msg);  
    }  
    catch(Exception ex)  
    {  
        MessageBox.Show(ex.Message);  
    }  
}  

Remarks

The value passed to Index is either an integer that is an index to a ColorableItems object in its FontsAndColorsItems collection or a string value that equates to a ColorableItems object in the collection.

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

Applies to