다음을 통해 공유


BuildDependencies.Item 메서드

BuildDependencies 컬렉션의 인덱싱된 멤버를 가져옵니다.

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

구문

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

매개 변수

  • index
    형식: System.Object
    필수 요소.반환할 항목의 인덱스입니다.

반환 값

형식: EnvDTE.BuildDependency
BuildDependency 개체

설명

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

예제

public void Example(DTE2 dte)
{
   try
   {
      BuildDependencies bldDepends;
      BuildDependency bldDependency = null;

      // Get the BuildDependencies in open solution.
      bldDepends = dte.Solution.SolutionBuild.BuildDependencies;
      if (bldDepends.Count > 0) // assign the BuildDependency
         bldDependency = bldDepends.Item(bldDepends.Count);
      // Show the BuildDependency returned by the Item property.
      MessageBox.Show(bldDependency.Project.Name);
      // Show the BuildDependencies top-level object.
      MessageBox.Show(bldDepends.DTE.Name);
   }
   catch (Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}

.NET Framework 보안

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

참고 항목

참조

BuildDependencies 인터페이스

EnvDTE 네임스페이스

기타 리소스

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