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 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
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
> Well since this is VB.NET keyword, what would the equivalent be for C#?
look for typeof() in help...
--
Best Regards
Yanick
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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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
...
|
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());
}
|
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...
|
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...
|
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...
|
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...
|
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...
|
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}"...
|
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)...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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: 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,...
|
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...
|
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...
|
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...
|
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...
| |