C# to VB.NET conversion (Generics confusion)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter

    C# to VB.NET conversion (Generics confusion)

    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(Act ion&lt;T&gt; handler)</c>
    method of <c>ISubscriptio nService&lt;T&g t;</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 <Thandler)
    {

    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:
    eventBrokerServ ice.Register(th is.OnConfEventO bjectsRead);

    Declaration of the event rouine:
    [MessageIdFilter (EventError.Mes sageId, ProtocolName = "ConfServer ",
    SdkName = "Configuration" )]
    private void OnConfEventErro r(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
  • Herfried K. Wagner [MVP]

    #2
    Re: C# to VB.NET conversion (Generics confusion)

    "Peter" <peter_m@circ le-consulting.co.n zschrieb:
    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 <Thandler)
    {
    >
    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:
    eventBrokerServ ice.Register(th is.OnConfEventO bjectsRead);
    ='<...>.Registe r(New Action(Of <type>)(Address Of
    OnConfEventObje ctsRead))'.

    --
    M S Herfried K. Wagner
    M V P <URL:http://dotnet.mvps.org/>
    V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

    Comment

    Working...