| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using System.Collections;
- using IwbZero.ToolCommon.StringModel;
- namespace IwbZero.IwbBase
- {
- public class IdCollection : CollectionBase
- {
- // Methods
- public int Add(IIwbId poObject)
- {
- return InnerList.Add(poObject);
- }
- public bool Contains(IIwbId poObject)
- {
- return (IndexOf(poObject) >= 0);
- }
- public bool Contains(string pcId)
- {
- return (IndexOf(pcId) >= 0);
- }
- public int IndexOf(IIwbId poObject)
- {
- return IndexOf(poObject.Id);
- }
- public int IndexOf(string pcId)
- {
- pcId = pcId.UAndT();
- for (int i = 0; i < InnerList.Count; i++)
- {
- IIwbId id = (IIwbId)InnerList[i];
- if (id.Id.UAndT() == pcId)
- {
- return i;
- }
- }
- return -1;
- }
- public void Remove(IIwbId poObject)
- {
- InnerList.Remove(poObject);
- }
- public void Remove(string pcId)
- {
- int index = IndexOf(pcId);
- if (index >= 0)
- {
- RemoveAt(index);
- }
- }
- // Properties
- public IIwbId this[int piIndex]
- {
- get
- {
- if ((piIndex < InnerList.Count) && (piIndex >= 0))
- {
- return (IIwbId)InnerList[piIndex];
- }
- return null;
- }
- }
- public IIwbId this[string pcId]
- {
- get
- {
- int index = IndexOf(pcId);
- if (index >= 0)
- {
- return (IIwbId)InnerList[index];
- }
- return null;
- }
- }
- }
- }
|