Projects.Item 메서드
Projects 컬렉션의 인덱싱된 멤버를 반환합니다.
네임스페이스: EnvDTE
어셈블리: EnvDTE(EnvDTE.dll)
구문
‘선언
Function Item ( _
index As Object _
) As Project
Project Item(
Object index
)
Project^ Item(
[InAttribute] Object^ index
)
abstract Item :
index:Object -> Project
function Item(
index : Object
) : Project
매개 변수
- index
형식: System.Object
필수적 요소로서,반환할 항목의 인덱스입니다.
반환 값
형식: EnvDTE.Project
Project 개체입니다.
설명
index에 전달되는 값은 컬렉션의 Project 개체에 대한 인덱스를 나타내는 정수입니다. index의 값은 컬렉션의 프로젝트 이름을 나타내는 문자열 값이 될 수도 있습니다.
Item 메서드는 컬렉션에서 인덱스 값에 해당하는 개체를 찾지 못하면 ArgumentException 예외를 throw합니다.
예제
public void CodeExample(DTE2 dte)
{
try
{ // Open a project before running this sample
Projects prjs = dte.Solution.Projects;
string msg = "There are " + prjs.Count.ToString() + " projects in this collection.";
msg += "\nThe application containing this Projects collection: " + prjs.DTE.Name;
msg += "\nThe parent object of the Projects collection: " + prjs.Parent.Name;
msg += "\nThe GUID representing the Projects type: " + prjs.Kind;
if (prjs.Properties != null)
{
msg += "\nProperties:";
foreach (Property prop in prjs.Properties)
{
msg += "\n " + prop.Name;
}
}
MessageBox.Show(msg, "Projects Collection");
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
.NET Framework 보안
- 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.