System.ComponentModel.EventDescriptorCollection.Find C# (CSharp) Method

Find() public method

public Find ( string name, bool ignoreCase ) : EventDescriptor
name string
ignoreCase bool
return EventDescriptor
        public virtual EventDescriptor Find(string name, bool ignoreCase) {
            EventDescriptor p = null;
            
            if (ignoreCase) {
                for(int i = 0; i < Count; i++) {
                    if (String.Equals(events[i].Name, name, StringComparison.OrdinalIgnoreCase)) {
                        p = events[i];
                        break;
                    }
                }
            }
            else {
                for(int i = 0; i < Count; i++) {
                    if (String.Equals(events[i].Name, name, StringComparison.Ordinal)) {
                        p = events[i];
                        break;
                    }
                }
            }
            
            return p;
        }
        

Usage Example

		public void Find_Key_Null ()
		{
			EventDescriptorCollection descriptors = new EventDescriptorCollection (
				new EventDescriptor[] { new MockEventDescriptor ("A", "X"),
					new MockEventDescriptor ("b", "Y")});

			Assert.IsNull (descriptors.Find (null, false), "#1");
			Assert.IsNull (descriptors.Find (null, true), "#2");
		}
All Usage Examples Of System.ComponentModel.EventDescriptorCollection::Find