okay, so here is what im doing:
class Connection
{
public int SERVERID;
private Thread connection;
public Connection()
{
connection = new Thread(new ThreadStart(this.Run));
}
public void Start(int serverid)
{
SERVERID = serverid;
connection.Start();
}
void Run()
{
while(true)
{
//do stuff here
}
}
}
now, there is the class i need to manage, here is how im calling it:
static void Main(string[] args)
{
StartConnection(1);
StartConnection(2);
StartConnection(3);
//etc
}
static void StartCOnnection(int serverid)
{
Connection connect = new Connection();
connect.Start(serverid);
}
i was origanally trying to do somthing like this:
foreach(Connection connect in Connection)
{
if(connect.SERVERID == 2)
{
//destroy the thread, and class.
}
}
but that gets the error " 'Connection' is a 'type' but is used like a 'variable' ", and i dont know how to do that destroy the thread and class part...
Summary: So what i basically need to do, is get a list of all the open Connetion class's, and be able to, based on the settings of the class be able to destroy it. how do i do this?
~code examples please