Aracılığıyla paylaş


EventDescriptorCollection.Item[] Özellik

Tanım

Belirtilen olayı alır.

Aşırı Yüklemeler

Name Description
Item[Int32]

Belirtilen dizin numarasına sahip olayı alır veya ayarlar.

Item[String]

Belirtilen ada sahip olayı alır veya ayarlar.

Item[Int32]

Kaynak:
EventDescriptorCollection.cs
Kaynak:
EventDescriptorCollection.cs
Kaynak:
EventDescriptorCollection.cs
Kaynak:
EventDescriptorCollection.cs
Kaynak:
EventDescriptorCollection.cs

Belirtilen dizin numarasına sahip olayı alır veya ayarlar.

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

Parametreler

index
Int32

Alınacak veya ayarlanacağı sıfır tabanlı dizin numarası EventDescriptor .

Özellik Değeri

EventDescriptor Belirtilen dizin numarasına sahip olan.

Özel durumlar

index için Item[Int32]geçerli bir dizin değil.

Örnekler

Aşağıdaki kod örneği, bir metin kutusundaki dizin numarası tarafından belirtilen adı EventDescriptor yazdırmak için özelliğini kullanırItem[]. Dizin numarası sıfır tabanlı olduğundan, bu örnek ikinci EventDescriptoröğesinin adını yazdırır. Bunu gerektirir button1 ve textBox1 bir formda örneklenmiştir.

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

Açıklamalar

Dizin numarası sıfır tabanlıdır. Bu nedenle, bu öğesine erişmek EventDescriptoriçin belirli EventDescriptor bir öğesinin sayısal konumundan 1 çıkarmanız gerekir. Örneğin, üçüncü EventDescriptordeğerini almak için belirtmeniz myColl[2]gerekir.

Ayrıca bkz.

Şunlara uygulanır

Item[String]

Kaynak:
EventDescriptorCollection.cs
Kaynak:
EventDescriptorCollection.cs
Kaynak:
EventDescriptorCollection.cs
Kaynak:
EventDescriptorCollection.cs
Kaynak:
EventDescriptorCollection.cs

Belirtilen ada sahip olayı alır veya ayarlar.

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

Parametreler

name
String

Alınacak veya ayarlanacağı öğesinin EventDescriptor adı.

Özellik Değeri

EventDescriptor belirtilen ada sahip veya null olay yoksa.

Örnekler

Aşağıdaki kod örneği, dizin tarafından belirtilen bileşenin türünü yazdırmak için EventDescriptor özelliğini kullanırItem[]. Bunu gerektirir button1 ve textBox1 bir formda örneklenmiştir.

private:
   void PrintIndexItem2()
   {
      
      // Creates a new collection and assigns it the events for button1.
      EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 );
      
      // Sets an EventDescriptor to the specific event.
      EventDescriptor^ myEvent = events[ "KeyDown" ];
      
      // Prints the name of the event.
      textBox1->Text = myEvent->Name;
   }
private void PrintIndexItem2() {
    // Creates a new collection and assigns it the events for button1.
    EventDescriptorCollection events = TypeDescriptor.GetEvents(button1);
 
    // Sets an EventDescriptor to the specific event.
    EventDescriptor myEvent = events["KeyDown"];
 
    // Prints the name of the event.
    textBox1.Text = myEvent.Name;
 }
Private Sub PrintIndexItem2()
    ' Creates a new collection and assigns it the events for button1.
    Dim events As EventDescriptorCollection = TypeDescriptor.GetEvents(button1)
    
    ' Sets an EventDescriptor to the specific event.
    Dim myEvent As EventDescriptor = events("KeyDown")
    
    ' Prints the name of the event.
    textBox1.Text = myEvent.Name
End Sub

Açıklamalar

Adlar Item[] aranırken özelliği büyük/küçük harfe duyarlıdır. Başka bir deyişle, "Ename" ve "ename" adları iki farklı olay olarak kabul edilir.

Uyarı

Bu HostProtectionAttribute sınıfa uygulanan öznitelik şu Resources özellik değerine sahiptir: Synchronization. HostProtectionAttribute masaüstü uygulamalarını etkilemez (genellikle bir simgeye çift tıklayarak, komut yazarak veya bir tarayıcıya URL girerek başlatılır). Daha fazla bilgi için bkz HostProtectionAttribute . sınıf veya SQL Server Programlama ve Konak Koruması Öznitelikleri.

Ayrıca bkz.

Şunlara uygulanır