C# to VB.NET conversion (Generics confusion)

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hi

I'm trying to call a C# Method from with VB.NET and am having all
sorts of troubles as I'm new to Generics. The C# method (which I
didn't develop) is as follows:

/// <summary>
/// Implementation of <c>Register(Action&lt;T&gt; handler)</c>
method of <c>ISubscriptionService&lt;T&gt;</c>
/// interface. Subscribes an action to be performed when a
publishing event occures.
/// Implements subscription functionality of the Publish/
Subscribe pattern.
/// The method also processes the filter custom attributes
which allows a user to define filters
/// externally.
/// </summary>
/// <param name="handler">Represents the method that performs
an action on the specified object
/// when a publishing event occures.</param>
public virtual void Register(Action<T> handler)
{

In my VB.NET code I need to call this Register method and pass to it
the name of the Routine I want called when an event is raised. The C#
examples I've been provided are as follows:

To Register your event routine:
eventBrokerService.Register(this.OnConfEventObjectsRead);

Declaration of the event rouine:
[MessageIdFilter(EventError.MessageId, ProtocolName = "ConfServer",
SdkName = "Configuration")]
private void OnConfEventError(IMessage theMessage)
{

Can someone help me convert the above statements to register an event
routine and declare an event routine to the equivalent VB.NET syntax.
I'm real stuck!

Thanks
 
Peter said:
I'm trying to call a C# Method from with VB.NET and am having all
sorts of troubles as I'm new to Generics. The C# method (which I
didn't develop) is as follows:
[...]
public virtual void Register(Action<T> handler)
{

In my VB.NET code I need to call this Register method and pass to it
the name of the Routine I want called when an event is raised. The C#
examples I've been provided are as follows:

To Register your event routine:
eventBrokerService.Register(this.OnConfEventObjectsRead);

=> '<...>.Register(New Action(Of <type>)(AddressOf
OnConfEventObjectsRead))'.
 
Back
Top