Ralph De Guzman
Ralph De Guzman

Reputation: 209

vb to c# code conversion

I am nearly complete on converting vb.net code to c#. Unfortunately, I am having problems in converting the following code to c#.

Public Event SomeSub(ByVal sender As Object, ByVal e As System.EventArgs) Implements SomeLayer.ISomeInterface.SomeSub

Upvotes: 2

Views: 403

Answers (2)

Marcel N.
Marcel N.

Reputation: 13976

It's just about implementing an interface event.

There's really no need to define a whole new delegate since the event complies to the "standard" EventHandler signature (Object and EventArgs params).

public event EventHandler SomeSub;

You can then use it as:

instance.SomeSub += (s, e) => { //handle event here };

Upvotes: 0

Neel
Neel

Reputation: 11721

Try below code :-

public event SomeSubEventHandler SomeLayer.ISomeInterface.SomeSub;
public delegate void SomeSubEventHandler(object sender, System.EventArgs e);

For future conversion you can use some converter tools as linked below :-

http://www.developerfusion.com/tools/convert/vb-to-csharp/?batchId=9fdbdc76-36a7-4d8a-a54a-e75b9ad8f5f8

http://converter.telerik.com/

Upvotes: 1

Related Questions