473,406 Members | 2,710 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,406 software developers and data experts.

GetType

What the difference between these two?

System.Type.GetType("System.Int32")
and
GetType(Integer)

Or more specifically, why does GetType(Integer) work, but not
System.Type.GetType(Integer)? What namespace is the GetType function(?) part
of?

I'm confused.

Greg
Nov 21 '05 #1
4 15092
Greg,
System.Type.GetType("System.Int32") You are calling a shared method of the System.Type class.
GetType(Integer) You are using a VB.NET keyword.
Or more specifically, why does GetType(Integer) work, but not
System.Type.GetType(Integer)? Type.GetType's parameter is defined to be a String, while the GetType
keyword requires the type identifier.
What namespace is the GetType function(?) part of? Being a keyword GetType(Integer) is not part of any namespace. Remember in
VS.NET keywords are normally Blue, while identifiers (members of classes)
are normally Black.

Hope this helps
Jay

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:Of****************@TK2MSFTNGP14.phx.gbl... What the difference between these two?

System.Type.GetType("System.Int32")
and
GetType(Integer)

Or more specifically, why does GetType(Integer) work, but not
System.Type.GetType(Integer)? What namespace is the GetType function(?)
part of?

I'm confused.

Greg

Nov 21 '05 #2
A keyword! Doh!

Well since this is VB.NET keyword, what would the equivalent be for C#?

Passing the type as a string with System.Type.GetType("System.Int32") seems
crude. Why would you ever need/want to do this?

Thanks Jay

Greg

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:ur****************@TK2MSFTNGP10.phx.gbl...
Greg,
System.Type.GetType("System.Int32")

You are calling a shared method of the System.Type class.
GetType(Integer)

You are using a VB.NET keyword.
Or more specifically, why does GetType(Integer) work, but not
System.Type.GetType(Integer)?

Type.GetType's parameter is defined to be a String, while the GetType
keyword requires the type identifier.
What namespace is the GetType function(?) part of?

Being a keyword GetType(Integer) is not part of any namespace. Remember in
VS.NET keywords are normally Blue, while identifiers (members of classes)
are normally Black.

Hope this helps
Jay

"Greg Burns" <greg_burns@DONT_SPAM_ME_hotmail.com> wrote in message
news:Of****************@TK2MSFTNGP14.phx.gbl...
What the difference between these two?

System.Type.GetType("System.Int32")
and
GetType(Integer)

Or more specifically, why does GetType(Integer) work, but not
System.Type.GetType(Integer)? What namespace is the GetType function(?)
part of?

I'm confused.

Greg


Nov 21 '05 #3
> Well since this is VB.NET keyword, what would the equivalent be for C#?

look for typeof() in help...

--
Best Regards
Yanick
Nov 21 '05 #4
Thanks

"Zoury" <yanick_lefebvre at hotmail dot com> wrote in message
news:Og***************@TK2MSFTNGP12.phx.gbl...
Well since this is VB.NET keyword, what would the equivalent be for C#?


look for typeof() in help...

--
Best Regards
Yanick

Nov 21 '05 #5

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

Similar topics

8
by: ron | last post by:
Hi, I am currently using the base class GetType() in the following way and was woundering if there was a different way of looking at types and doing a comparison for equality. Thanks Ron ...
9
by: Yan Vinogradov | last post by:
Hi, Turns out it's possible to spoof another type with Object.GetType method. If you do this: namespace N { class C { public new Type GetType() { return (String.Empty.GetType()); }
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...
5
by: Matthew | last post by:
I have a nice little Sub that saves data in a class "mySettings" to an XML file. I call it like so: Dim mySettings As mySettings = New mySettings mySettings.value1 = "someText" mySettings.value2...
4
by: Howard Kaikow | last post by:
For the code below, for both appWord and gappWord, I get the error "Public member 'GetType' on type 'ApplicationClass' not found" I realize the test for appWord is superflous as the parameter...
3
by: Joe Adams | last post by:
Hi All, How can I use GetType(<GenericType>).IsAssignableFrom(<MyType>) I need to now if the <MyType> is the same type of class as the <GenericType> without having to add the generic type...
3
by: Erland | last post by:
Hi, I've been trying to load a type and and get all of the methods within that type. I finally made it happen by using typeof, but im really stumped how could one implement the same with...
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}"...
2
by: Carlos Rodriguez | last post by:
I have the following function in C#public void Undo(IDesignerHost host) { if (!this.componentName.Equals(string.Empty) && (this.member != null)) { IContainer container1 = (IContainer)...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.