473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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(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<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:
eventBrokerService.Register(this.OnConfEventObject sRead);

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
Jun 27 '08 #1
1 984
"Peter" <pe*****@circle-consulting.co.nzschrieb:
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:
eventBrokerService.Register(this.OnConfEventObject sRead);
='<...>.Register(New Action(Of <type>)(AddressOf
OnConfEventObjectsRead))'.

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

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Vijai Kalyan | last post by:
Hello, I have come back to C++ after a couple of years with Java so I am quite rusty and this question may seem poor: My platform is Windows XP with MSVC 7.1. I have a class with a...
14
by: junky_fellow | last post by:
Can anybody please explain this: When a value with integer type is converted to another integer type other than _Bool, if the new type is unsigned, the value is converted by repeatedly...
2
by: Wiktor Zychla | last post by:
I've read several documents about upcoming C# generics and I still cannot understand one thing. Would it be valid to write a code like this: class SomeClass { public void AMethod<T>(T a, T...
14
by: Richard G. Riley | last post by:
Would it be wrong to use "implicit casting" instead of the standards "implicit conversion" when talking about implicit conversions between certain data types. The standard mentions "explicit...
9
by: sloan | last post by:
I'm not the sharpest knife in the drawer, but not a dummy either. I'm looking for a good book which goes over Generics in great detail. and to have as a reference book on my shelf. Personal...
10
by: =?Utf-8?B?RWxlbmE=?= | last post by:
I am surprised to discover that c# automatically converts an integer to a string when concatenating with the "+" operator. I thought c# was supposed to be very strict about types. Doesn't it seem...
2
by: joseph_gallagher | last post by:
Hi, I've been playing with generics and I was wondering if anyone could tell me why the following doesnt work, and if there is another way to do it public class A<Twhere T : B, new() {...
13
by: =?Utf-8?B?RGF2ZSBXZWVkZW4=?= | last post by:
Hi all, I'm having trouble with a project that I've distilled down to the following code. Unfortunately it won't compile and gives the following error (caused by the call to GetHorses() in...
9
by: =?Utf-8?B?RmxhdmVsbGUgQmFsbGVt?= | last post by:
Apparently the Java Conversion tool that used to be in Visual Studio 2005 is no longer supported in Visual Studio 2008. Anyone have any suggestions on how to convert a Java program to C# in Visual...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.