473,385 Members | 1,593 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,385 software developers and data experts.

'GetType' Question

Still on my quest to convert my company's VB.NET code to C#.

Here's the line I need to convert
VB.NET
System.Runtime.Remoting.RemotingServices.Connect(G etType(ISensor),
strURL))

where ISensor is a public Interface in a referenced class library (DLL)
and the strURL is a valid URI path.
C# Equivalent???
I've tried this in C#
RemotingServices.Connect(Type.GetType("ISensor"), strURL));
RemotingServices.Connect(Type.GetType("Sensors.ISe nsor"), strURL));
..
..
..
And as many other iterations as I could possibly think of using
namespaces and such. I'm stuck here since I can't figure out how to
get the type of the ISensor Interface to use with the "Connect" call.
C# seems to have no "Type GetType(object ob)" operator.

Thank you and Sincerely,

Kevin

Nov 16 '05 #1
2 1577
Razzerroo <ke****@lucidyne.com> wrote:
Still on my quest to convert my company's VB.NET code to C#.

Here's the line I need to convert
VB.NET
System.Runtime.Remoting.RemotingServices.Connect(G etType(ISensor),
strURL))

where ISensor is a public Interface in a referenced class library (DLL)
and the strURL is a valid URI path.
C# Equivalent???
I've tried this in C#
RemotingServices.Connect(Type.GetType("ISensor"), strURL));
RemotingServices.Connect(Type.GetType("Sensors.ISe nsor"), strURL));
.
.
.
And as many other iterations as I could possibly think of using
namespaces and such. I'm stuck here since I can't figure out how to
get the type of the ISensor Interface to use with the "Connect" call.
C# seems to have no "Type GetType(object ob)" operator.


I suspect you're after the "typeof" operator.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
I suspect you're right. (c;
Works perfectly, Thank you

-Kevin

Nov 16 '05 #3

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

Similar topics

2
by: JohnnySparkles | last post by:
Hi everyone, I'm currently writing an application which uses the XmlSerializer class to serialize/deserialize objects to/from xml. Now when deserializing an XmlDocument back into the object,...
6
by: h | last post by:
Hi! I have a user control called ListItemControl. This works ok: ListItemControl li = new ListItemControl(); When I iterate with Enumerator through all controls using: IEnumerator e =...
6
by: Jim Bancroft | last post by:
Hi everyone, I'm having some trouble with the code below. I receive a compile-time error on the second line saying "; expected": private static void myTestFunction(long myLong) { ...
10
by: Bob | last post by:
This has been bugging me for a while now. GetType isn't availble for variables decalred as interface types, I have to DirectCast(somevariable, Object). In example: Sub SomeSub(ByVal...
1
by: Jennyfer Barco | last post by:
Hello I have a question. I have a project called "Primary" and in that project I have a reference to a Com application called "engine". In "engine" I have a function that does many things and calls...
6
by: Paul | last post by:
I have two projects in one solution. One is called Frontier and holds all my base user controls, classes, etc. that are used over multiple applications. The second is my application project...
7
by: Sky | last post by:
I have been looking for a more powerful version of GetType(string) that will find the Type no matter what, and will work even if only supplied "{TypeName}", not the full "{TypeName},{AssemblyName}"...
3
by: Ron M. Newman | last post by:
Hi, I have a certain assembly that needs to create instances of objects where the object class is passed as a string (e.g. "System.Drawing.Bitmap"). I have found that calling "GetType" on this...
4
by: Steph | last post by:
hello, i want to find the type from a generic... like : public static john<T>(object obj, T myControl) { ((myControl.getType())myControl).OnClientClick ="code"; } because my generic var can...
5
by: TonyJ | last post by:
Hello!! This first expression return System.Int32. The type that is returned is a string. This is perfect understandable. Console.WriteLine(7.GetType().FullName); In this second expression is...
1
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: 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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.