Bhuwan Bhaskar wrote:
> Thnaks Edgar,
>
> Can we declare delegates inside Interface.
>
> Regards,
> Bhuwan
Edgar already answered that:
"Since a delegate is a type that inherits from delegate you cannot
declare a delegate within an interface".
> "Edgar Harris" <(E-Mail Removed)> wrote in message
> news:AF89D711-97E3-4D0C-ADA2-(E-Mail Removed)...
>> Yes and no. The thing to remember about delegates is they are in
>> themselves
>> classes that inherit from System.Delegate. Since nested classes are
>> allowed
>> in classes you my declare a delegate in a class. For example the
>> following
>> is legal:
>>
>> public class MyClass
>> {
>> public delegate void MyDelegate();
>> }
>>
>> To reference that delegate outside of MyClass you would write the
>> following:
>>
>> MyClass.MyDelegate myDel;
>>
>> Since a delegate is a type that inherits from delegate you cannot declare
>> a
>> delegate within an interface, because you cannot declare nested types in
>> an
>> interface. That being said I tend to declare my delegates outside of a
>> class
>> and inside a namespace, because like I said delegates really are just
>> classes.
>>
>>
>> "Bhuwan Bhaskar" wrote:
>>
>>> Hello,
>>>
>>> Can we declare delegates in the class? Can we declare delegates in
>>> interface
>>> ?
>>>
>>> Warm Regards,
>>>
>>> Bhuwan
>>>
--
Göran Andersson
_____
http://www.guffa.com