Properties.Item 메서드

Properties 컬렉션의 인덱싱된 멤버를 반환합니다.

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

구문

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

매개 변수

반환 값

형식: EnvDTE.Property
Property 개체입니다.

설명

Index에 전달되는 값은 Properties 컬렉션에 있는 Property 개체의 인덱스 값 또는 컬렉션에 있는 Property 개체의 이름입니다.

컬렉션에서 지정된 값을 찾을 수 없는 경우 Item 메서드에서 ArgumentException 예외를 throw합니다.

예제

public void CodeExample(DTE2 dte)
{  
    try
    {   // Open a solution before running this example
        Properties props = dte.Solution.Properties;
        Property prop;
        string msg;
        msg = "How many properties are there in the current solution: " + props.Count.ToString();
        msg += "\nThe application containing this Properties collection is " + props.DTE.Name;
        msg += "\nThe parent object of the Properties collection is a " + ((Solution)props.Parent).FullName;
        msg += "\nThe application property returns : " + ((DTE2)props.Application).Name;
        if (props.Count > 0)
        {
            prop = props.Item(1);
            msg += "\nThe first Property in the Properties collection is " + prop.Name;
        }
        MessageBox.Show(msg);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

Properties 인터페이스

EnvDTE 네임스페이스

기타 리소스

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