123456789101112131415161718192021222324252627 |
- using System.Collections;
- namespace System.Windows.Forms
- {
- public partial class CheckedListBox
- {
- public class CheckedItemCollection : CollectionBase
- {
- private static string message = "Collection is read only.";
- public object this[int index] => ((Item)List[index]).Value;
- internal void Add(object obj) => List.Add(obj);
- public new void Clear() => throw new NotSupportedException(message);
- public new void RemoveAt(int index) => throw new NotSupportedException(message);
- // the reason for this method is that enumerator must return Item.Value rather than Item itself
- public new IEnumerator GetEnumerator()
- {
- foreach (Item item in List)
- yield return item.Value;
- }
- }
- }
- }
|