using System; namespace System.ComponentModel { /// Provides a simple list of delegates. This class cannot be inherited. // Token: 0x02000081 RID: 129 public sealed class EventHandlerList : IDisposable { /// Gets or sets the delegate for the specified object. /// The delegate for the specified key, or null if a delegate does not exist. /// An object to find in the list. // Token: 0x17000137 RID: 311 public Delegate this[object key] { get { if (key == null) { return this.null_entry; } ListEntry listEntry = this.FindEntry(key); if (listEntry != null) { return listEntry.value; } return null; } set { this.AddHandler(key, value); } } /// Adds a delegate to the list. /// The object that owns the event. /// The delegate to add to the list. // Token: 0x060004A4 RID: 1188 RVA: 0x0000D6A8 File Offset: 0x0000B8A8 public void AddHandler(object key, Delegate value) { if (key == null) { this.null_entry = Delegate.Combine(this.null_entry, value); return; } ListEntry listEntry = this.FindEntry(key); if (listEntry == null) { listEntry = new ListEntry(); listEntry.key = key; listEntry.value = null; listEntry.next = this.entries; this.entries = listEntry; } listEntry.value = Delegate.Combine(listEntry.value, value); } /// Adds a list of delegates to the current list. /// The list to add. // Token: 0x060004A5 RID: 1189 RVA: 0x0000D718 File Offset: 0x0000B918 public void AddHandlers(EventHandlerList listToAddFrom) { if (listToAddFrom == null) { return; } for (ListEntry next = listToAddFrom.entries; next != null; next = next.next) { this.AddHandler(next.key, next.value); } } /// Removes a delegate from the list. /// The object that owns the event. /// The delegate to remove from the list. // Token: 0x060004A6 RID: 1190 RVA: 0x0000D758 File Offset: 0x0000B958 public void RemoveHandler(object key, Delegate value) { if (key == null) { this.null_entry = Delegate.Remove(this.null_entry, value); return; } ListEntry listEntry = this.FindEntry(key); if (listEntry == null) { return; } listEntry.value = Delegate.Remove(listEntry.value, value); } /// Disposes the delegate list. // Token: 0x060004A7 RID: 1191 RVA: 0x0000D7A0 File Offset: 0x0000B9A0 public void Dispose() { this.entries = null; } // Token: 0x060004A8 RID: 1192 RVA: 0x0000D7AC File Offset: 0x0000B9AC private ListEntry FindEntry(object key) { for (ListEntry next = this.entries; next != null; next = next.next) { if (next.key == key) { return next; } } return null; } // Token: 0x0400017A RID: 378 private ListEntry entries; // Token: 0x0400017B RID: 379 private Delegate null_entry; } }