Good day!
I want to subscribe on event at console app. For example, i have some data provider wich get event OnDataChanged -when new data from database come in.
So, my program is such like this:
public static void Main()
{
dataProvider.OnDataChanged+=myevent_OnDataChanged;
}
static void myevent_OnDataChanged(object sender, DataChangeEventArgs e)
{
Console.WriteLine("my event!");
}
So, if it be an WinForm app - i know than user should click button and my event will be changed.
But how to suscribe and get event in console app? I should write :
public static void Main()
{
while(true)
{
dataProvider.OnDataChanged+=myevent_OnDataChanged;
}
}
Or Console.ReadLine()?
Thank you!