I was wondering if there was a way for an instance of a class to access its parent class's method(s) while preserving the data during runtime. (Did that make any sense?)
I have a ConnectionManager that spawns several Connectors (which is in charge of COM port communications) if there is a multiple COM Port setup.
file1.cs
namespace connector
{
public class connectormanager : idisposable
{
public connectormanager(comport1, comport2, retries, delay)
{
// create dictionary that maps COMPorts with devices
// **foreach spawn connector (if com port range is given)**
}
public searchchannel()
{
// search existing com ports
}
}
}
file2.cs
namespace connector
{
public class connector : idisposable
{
public void connector(port, retries, delay)
{
// there is a timer with a timeout event defined
}
// com port read/write operations
void _timer_Elapsed()
{
// **i want to access searchchannel**
// problem is if i create a new instance of connectionmanager
// i lose all the dictionary stuff
}
}
}
both files are under the same solution and project. what I want to do is access search channel from _timer_Elapsed in file2.cs without creating a new instance of the connector manager.
Any advice or help greatly appreciated.