I have an application that, on occasion, might need to perform certain tasks on files, or other things that are "in-use" while the application in running.
This is what I've tried to do, but I'm running into problems:
I created an interface:
interface IShutdownCommand
{
void OnShutdown();
}
I wanted to create, on my main application window code the following:
//initialize shutdown Commands
public List<IShutdownCommand> ShutdownCommandList;
private void Main_FormClosing(object sender, FormClosingEventArgs e)
{
foreach (IShutdownCommand Command in ShutdownCommandList)
{
Command.OnShutdown();
}
}
But I'm getting this compiler error:
"Inconsistent accessibility: field type 'System.Collections.Generic.List<DATA.IShutdownCommand>' is less accessible than field 'DATA.Main.ShutdownCommandList'"
Any thoughts on how I could do this and actually get it to work?