Share via


OutputGroups.Item 메서드

OutputGroups 컬렉션의 OutputGroup 개체를 반환합니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

‘선언
Function Item ( _
    index As Object _
) As OutputGroup
OutputGroup Item(
    Object index
)
OutputGroup^ Item(
    [InAttribute] Object^ index
)
abstract Item : 
        index:Object -> OutputGroup
function Item(
    index : Object
) : OutputGroup

매개 변수

  • index
    형식: Object

    필수입니다. 반환할 OutputGroup 개체의 인덱스입니다.

반환 값

형식: EnvDTE.OutputGroup
OutputGroup 개체

설명

Index에 전달되는 값은 OutputGroups 컬렉션에 있는 OutputGroup 개체의 인덱스를 나타내는 정수 또는 컬렉션에 있는 OutputGroup 개체의 이름을 나타내는 문자열 값입니다.

Item 메서드는 컬렉션에서 인덱스 값에 해당하는 개체를 찾지 못하면 ArgumentException 예외를 throw합니다.

예제

public void CodeExample(DTE2 dte)
{  
    try
    {
        // Open a project before running this example.
        Project proj = dte.Solution.Projects.Item(1);
        OutputGroups groups = proj.ConfigurationManager.ActiveConfiguration.OutputGroups;
        int c = 1;
        int x = 0;
        string msg;
        // Find the last outputgroup with at least one file.
        foreach (OutputGroup grp in groups)
        {
            x++;
            if (grp.FileCount > 0)
                c = x;
        }
        OutputGroup group = groups.Item(c);
        msg = "The " + c + "/" + groups.Count + " item in the OutputGroups groups collection is " +
            group.DisplayName;
        msg += "\nThe parent of the collection is the Configuration: " + groups.Parent.ConfigurationName;
        msg += "\nThe application containing this collection is: " + groups.DTE.Name;
        MessageBox.Show(msg);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework 보안

참고 항목

참조

OutputGroups 인터페이스

EnvDTE 네임스페이스

기타 리소스

방법: 자동화 개체 모델 코드의 예제 컴파일 및 실행