get listeners in c#

Here it is an example how to get listeners in c#:

Data d = new Data();
d.OnSave += delegate { Console.WriteLine("onSave event"); };
var handler = typeof(Data).GetField("OnSave", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(d) as Delegate;
var subscribers = handler.GetInvocationList();
if (subscribers.Count() == 0)
{
//no listeners added
}
else
{
//invoke them
foreach (var s in subscribers)
{
s.DynamicInvoke(null, null);
}
}