Auto-incrementing ID counter
Description: A property that increments automatically each time it is accessed.
Link: http://www.codekeep.net/snippets/7440fda7-0c38-42ca-8645-af46eae49379.aspx
private int m_idCounter = 1;
/// <summary>
/// This is the IDCounter that will be used to designate a node's ID.
/// It will automatically increment each time it is accessed.
/// </summary>
public int IDCounter
{
get
{
// Increment the counter
m_idCounter = m_idCounter + 1;
// If this ID already exists, increment the counter. Repeat as necessary.
while (idList.Contains(m_idCounter))
{
m_idCounter = m_idCounter + 1;
}
// Add this ID to the idList
idList.Add(m_idCounter);
return m_idCounter;
}
set { m_idCounter = value; }
}






