See is this works for you...
_________________________________________
public class UserList{
private int maxCount;
private Queue userQueue;
private UserList()
{
}
public UserList(int maxCount)
{
this.maxCount = maxCount;
userQueue = new Queue(maxCount);
}
public void Add(string userName)
{
lock(userQueue.SyncRoot)
{
if (userQueue.Count == maxCount)
userQueue.Dequeue();
userQueue.Enqueue(userName);
}
}
public string[] GetUsers()
{
string[] users = new string[userQueue.Count];
lock(userQueue.SyncRoot)
{
int i = 0;
foreach(object item in userQueue)
{
users[i] = item.ToString();
i ++;
}
}
return users;
}
}
_______________________________________
--
Shiv R. Kumar
http://www.matlus.com
"Aaron" <ku*****@yahoo.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
My problem is I don't know how to write this code. :) im new to c#.
is. Do you want an object that will maintain a list of 5 (or a
configurable number) user names?
Yes, a list of 5
thanks in advance
"Shiv Kumar" <sh***@erolsnoooospaaaam.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl... Ok, I understand what you want. What I don't understand is what your
problem is. Do you want an object that will maintain a list of 5 (or a
configurable number) user names?
--
Shiv R. Kumar
http://www.matlus.com