Thanks Jon. Though i am new here, I have seen many many many posts of yor
over here ... thanks for your efforts for the community...
Yes i could implement this vb interface in C# class, bind an event to this
delegate 'handler' and execute this event...
> Thanks Jon. Though i am new here, I have seen many many many posts of yor
> over here ... thanks for your efforts for the community...
My pleasure - very literally. I wouldn't post if I didn't enjoy it :)
> Yes i could implement this vb interface in C# class, bind an event to this
> delegate 'handler' and execute this event...
This is why it doesn't make much sense to me to have the delegate type
in an interface - it's something that you wouldn't need to implement,
because it's just a type declaration. If you want the interface to
specify a member to be implemented (such as a property or event) which
is *of* a particular type, that's a different matter.
It's worth being clear about the difference between declaring a new
delegate type, and declaring a variable/property/event of that type.
Hopefully
http://pobox.com/~skeet/csharp/events.html will help even though it's
in C#. I'm sure the same things apply to VB.
Just to clarify - do you have a VB interface which you need to
implement in C#, or a slightly different situation?

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
HelloWorld - 29 Feb 2008 09:48 GMT
No its exactly the same situation. One of our other team were having these
VB.NET interfaces having these delegates in them. They wanted to implement
these on C# interfaces and were fumbling with not being able to create these
for C# (from rather wondring perspective to 'implement' those delegates). It
came down to C# can not allow this being done and hence the query.
:)
>> Thanks Jon. Though i am new here, I have seen many many many posts of yor
>> over here ... thanks for your efforts for the community...
[quoted text clipped - 19 lines]
> Just to clarify - do you have a VB interface which you need to
> implement in C#, or a slightly different situation?
Jon Skeet [C# MVP] - 29 Feb 2008 10:10 GMT
> No its exactly the same situation. One of our other team were having these
> VB.NET interfaces having these delegates in them. They wanted to implement
> these on C# interfaces and were fumbling with not being able to create these
> for C# (from rather wondring perspective to 'implement' those delegates). It
> came down to C# can not allow this being done and hence the query.
Just tried it, and basically you don't need to do anything with the
delegate types. They're just extra types which are available. Here's an
example:
IFoo.vb:
Public Interface IFoo
Function GimmeString() As String
Delegate Function Abc() As Object
End Interface
Foo.cs:
class Foo : IFoo
{
public string GimmeString()
{
return "Yes";
}
}
Note that you don't need to "implement" IFoo.Abc.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
HelloWorld - 29 Feb 2008 11:32 GMT
thanks :)
>> No its exactly the same situation. One of our other team were having
>> these
[quoted text clipped - 28 lines]
>
> Note that you don't need to "implement" IFoo.Abc.
HelloWorld - 29 Feb 2008 12:57 GMT
thanks :)
>> No its exactly the same situation. One of our other team were having
>> these
[quoted text clipped - 28 lines]
>
> Note that you don't need to "implement" IFoo.Abc.