PropertyDescriptorCollection.Item[] 속성

정의

지정된 PropertyDescriptor을 가져오거나 설정합니다.

오버로드

Name Description
Item[Int32]

지정된 인덱스 번호의 PropertyDescriptor 값을 가져오거나 설정합니다.

Item[String]

지정된 이름을 가진 PropertyDescriptor 값을 가져오거나 설정합니다.

Item[Int32]

Source:
PropertyDescriptorCollection.cs
Source:
PropertyDescriptorCollection.cs
Source:
PropertyDescriptorCollection.cs
Source:
PropertyDescriptorCollection.cs
Source:
PropertyDescriptorCollection.cs

지정된 인덱스 번호의 PropertyDescriptor 값을 가져오거나 설정합니다.

public:
 virtual property System::ComponentModel::PropertyDescriptor ^ default[int] { System::ComponentModel::PropertyDescriptor ^ get(int index); };
public virtual System.ComponentModel.PropertyDescriptor this[int index] { get; }
member this.Item(int) : System.ComponentModel.PropertyDescriptor
Default Public Overridable ReadOnly Property Item(index As Integer) As PropertyDescriptor

매개 변수

index
Int32

가져올 인덱스 또는 설정할 인 PropertyDescriptor 덱스(0부터 시작)입니다.

속성 값

PropertyDescriptor 지정된 인덱스 번호가 있는 값입니다.

예외

매개 변수가 index .에 대한 유효한 인덱스가 Item[Int32]아닙니다.

예제

다음 코드 예제에서는 속성을 사용 하 여 Item[] 텍스트 상자에 인덱스 번호로 지정 된 이름을 PropertyDescriptor 인쇄 합니다. 인덱스 번호는 0부터 시작하는 예제이므로 두 번째 PropertyDescriptor인덱스의 이름을 인쇄합니다. 폼에서 button1 인스턴스화해야 합니다.

void PrintIndexItem()
{
   
   // Creates a new collection and assigns it the properties for button1.
   PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 );
   
   // Prints the second property's name.
   textBox1->Text = properties[ 1 ]->ToString();
}
private void PrintIndexItem() {
    // Creates a new collection and assigns it the properties for button1.
    PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);
 
    // Prints the second property's name.
    textBox1.Text = properties[1].ToString();
 }
Private Sub PrintIndexItem()
    ' Creates a new collection and assigns it the properties for button1.
    Dim properties As PropertyDescriptorCollection = TypeDescriptor.GetProperties(button1)
       
    ' Prints the second property's name.
    textBox1.Text = properties(1).ToString()
End Sub

설명

인덱스 번호는 0부터 시작하는 값입니다. 따라서 해당 위치에 액세스PropertyDescriptor하려면 특정 PropertyDescriptor 위치의 숫자 위치에서 1을 빼야 합니다. 예를 들어 세 번째 PropertyDescriptor항목을 얻으려면 .를 지정 myColl[2]해야 합니다.

추가 정보

적용 대상

Item[String]

Source:
PropertyDescriptorCollection.cs
Source:
PropertyDescriptorCollection.cs
Source:
PropertyDescriptorCollection.cs
Source:
PropertyDescriptorCollection.cs
Source:
PropertyDescriptorCollection.cs

지정된 이름을 가진 PropertyDescriptor 값을 가져오거나 설정합니다.

public:
 virtual property System::ComponentModel::PropertyDescriptor ^ default[System::String ^] { System::ComponentModel::PropertyDescriptor ^ get(System::String ^ name); };
public virtual System.ComponentModel.PropertyDescriptor? this[string name] { get; }
public virtual System.ComponentModel.PropertyDescriptor this[string name] { get; }
member this.Item(string) : System.ComponentModel.PropertyDescriptor
Default Public Overridable ReadOnly Property Item(name As String) As PropertyDescriptor

매개 변수

name
String

컬렉션에서 가져올 이름 PropertyDescriptor 입니다.

속성 값

PropertyDescriptor 지정한 이름을 사용하거나 null 속성이 없는 경우입니다.

예제

다음 코드 예제에서는 속성을 사용 하 여 Item[] 인덱스로 지정 된 구성 요소 PropertyDescriptor 의 형식을 인쇄 합니다. 이를 요구 button1 하며 textBox1 양식에서 인스턴스화되었습니다.

void PrintIndexItem2()
{
   
   // Creates a new collection and assigns it the properties for button1.
   PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 );
   
   // Sets a PropertyDescriptor to the specific property.
   PropertyDescriptor^ myProperty = properties[ "Opacity" ];
   
   // Prints the display name for the property.
   textBox1->Text = myProperty->DisplayName;
}
private void PrintIndexItem2() {
   // Creates a new collection and assigns it the properties for button1.
   PropertyDescriptorCollection properties =
       TypeDescriptor.GetProperties(button1);

   // Sets a PropertyDescriptor to the specific property.
   PropertyDescriptor myProperty = properties["Opacity"];

   // Prints the display name for the property.
   textBox1.Text = myProperty.DisplayName;
}
Private Sub PrintIndexItem2()
    ' Creates a new collection and assigns it the properties for button1.
    Dim properties As PropertyDescriptorCollection = _
       TypeDescriptor.GetProperties(button1)
       
    ' Sets a PropertyDescriptor to the specific property.
    Dim myProperty As PropertyDescriptor = properties("Opacity")
       
    ' Prints the display name for the property.
    textBox1.Text = myProperty.DisplayName
End Sub

설명

Item[] 이 속성은 이름을 검색할 때 대/소문자를 구분합니다. 즉, 이름 "Pname" 및 "pname"은 서로 다른 두 가지 속성으로 간주됩니다.

추가 정보

적용 대상