J Jon Shemitz Apr 4, 2005 #1 Imagine you have a Type value - how can you tell if it's a delegate? If it's NOT a class, a struct, an enum, or an interface?
Imagine you have a Type value - how can you tell if it's a delegate? If it's NOT a class, a struct, an enum, or an interface?
B Brock Allen Apr 4, 2005 #2 object o = GetDelegate(); if (o is Delegate) { // Yes, Jim we have a delegate.... } -Brock DevelopMentor http://staff.develop.com/ballen
object o = GetDelegate(); if (o is Delegate) { // Yes, Jim we have a delegate.... } -Brock DevelopMentor http://staff.develop.com/ballen
B Brock Allen Apr 4, 2005 #3 Oops, you said a Type reference. Ok, how's this: Type t = GetDelegateType(); if (typeof(Delegate).IsAssignableFrom(t)) { // Yes, Jim we have a delegate.... } -Brock DevelopMentor http://staff.develop.com/ballen
Oops, you said a Type reference. Ok, how's this: Type t = GetDelegateType(); if (typeof(Delegate).IsAssignableFrom(t)) { // Yes, Jim we have a delegate.... } -Brock DevelopMentor http://staff.develop.com/ballen
J Jon Shemitz Apr 4, 2005 #4 Brock said: Type t = GetDelegateType(); if (typeof(Delegate).IsAssignableFrom(t)) { // Yes, Jim we have a delegate.... } Click to expand... Yes, thanks, that's what I came up with soon after posting. I was expecting something like IsClass and IsEnum ....
Brock said: Type t = GetDelegateType(); if (typeof(Delegate).IsAssignableFrom(t)) { // Yes, Jim we have a delegate.... } Click to expand... Yes, thanks, that's what I came up with soon after posting. I was expecting something like IsClass and IsEnum ....