In .NET, Is there a way to check whether an object is of a delegate type?
I need this because I\'m logging the parameters of method calls, and I want to print
This works perfectly for me
class Test
{
public delegate void MyHandler(string x);
public void RunTest()
{
var del = new MyHandler(Method);
if (del is Delegate)
{
Console.WriteLine(@"del is a delegate.");
}
else
{
Console.WriteLine("del is not a delegate");
}
}
private void Method(string myString)
{
}
}