|
using System;
using System.Collections;
namespace CardfileCE
{
/// <summary>
/// Summary description for CardCollection.
/// </summary>
public class CardCollection : CollectionBase
{
public CardCollection()
{
}
public CardCollection(CardType[] arr)
{
AddRange(arr);
}
public CardCollection(CardCollection rhs)
{
if ( rhs != null )
{
foreach ( CardType item in InnerList )
{
Add(item);
} // foreach
} // if
}
/// <summary>
public CardType this[int index]
{
get { return (CardType) InnerList[index]; }
}
public void Add(CardType item)
{
InnerList.Add(item);
}
public void AddRange(CardType[] items)
{
InnerList.AddRange(items);
}
public void Remove(CardType item)
{
InnerList.Remove(item);
}
public int IndexOf(CardType item)
{
return InnerList.IndexOf(item);
}
public void Insert(int index, CardType item)
{
InnerList.Insert(index, item);
}
public CardType FindByID(Int32 id)
{
// Find the card
CardType card = null;
try
{
foreach ( CardType item in InnerList )
{
if ( item.Header.ID == id ) card = item;
} // foreach
} // try
catch (Exception)
{
// Blow it off and return a null card reference...
} // catch
return card; // may not be null
}
public CardType[] ToArray()
{
return (CardType[])InnerList.ToArray(typeof(CardType));
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.