Hello,
Assume, I got an instance of a certain class that is boxed in an object. How
can I retrieve the type of the original class only using this object. The
type I get with GetType is always System.RuntimeType; the only reference I
can find is over its FullName-property. Is there another way to get the type
info?
Thanks,
Klaus 6 2134
"Klaus Löffelmann" <fo***********@loeffelmann.de> schrieb Assume, I got an instance of a certain class that is boxed in an object. How can I retrieve the type of the original class only using this object. The type I get with GetType is always System.RuntimeType; the only reference I can find is over its FullName-property. Is there another way to get the type info?
How do you get System.RuntimeType?
If o.GetType.Fullname returns <yourclass>, it's ok, so o.GetType returns
Gettype(yourclass) which is the type object representing your type.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
"Klaus Löffelmann" <fo***********@loeffelmann.de> schrieb Assume, I got an instance of a certain class that is boxed in an object. How can I retrieve the type of the original class only using this object. The type I get with GetType is always System.RuntimeType; the only reference I can find is over its FullName-property. Is there another way to get the type info?
How do you get System.RuntimeType?
If o.GetType.Fullname returns <yourclass>, it's ok, so o.GetType returns
Gettype(yourclass) which is the type object representing your type.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
"Armin Zingler" <az*******@freenet.de> schrieb im Newsbeitrag
news:40***********************@news.freenet.de... "Klaus Löffelmann" <fo***********@loeffelmann.de> schrieb Assume, I got an instance of a certain class that is boxed in an object. How can I retrieve the type of the original class only using this object. The type I get with GetType is always System.RuntimeType; the only reference I can find is over its FullName-property. Is there another way to get the type info?
How do you get System.RuntimeType? If o.GetType.Fullname returns <yourclass>, it's ok, so o.GetType returns Gettype(yourclass) which is the type object representing your type.
In the local/auto window it says "System.RuntimeType" for the type of o, but
you're right, though:
If I test it, then
TypeOf o is <yourclass>
returns True.
So, what's the deal with System.RuntimeType, anyway?
Klaus
"Armin Zingler" <az*******@freenet.de> schrieb im Newsbeitrag
news:40***********************@news.freenet.de... "Klaus Löffelmann" <fo***********@loeffelmann.de> schrieb Assume, I got an instance of a certain class that is boxed in an object. How can I retrieve the type of the original class only using this object. The type I get with GetType is always System.RuntimeType; the only reference I can find is over its FullName-property. Is there another way to get the type info?
How do you get System.RuntimeType? If o.GetType.Fullname returns <yourclass>, it's ok, so o.GetType returns Gettype(yourclass) which is the type object representing your type.
In the local/auto window it says "System.RuntimeType" for the type of o, but
you're right, though:
If I test it, then
TypeOf o is <yourclass>
returns True.
So, what's the deal with System.RuntimeType, anyway?
Klaus
"Klaus Löffelmann" <fo***********@loeffelmann.de> schrieb How do you get System.RuntimeType? If o.GetType.Fullname returns <yourclass>, it's ok, so o.GetType returns Gettype(yourclass) which is the type object representing your type.
In the local/auto window it says "System.RuntimeType" for the type of o, but you're right, though: If I test it, then
TypeOf o is <yourclass>
returns True.
So, what's the deal with System.RuntimeType, anyway?
Hmmm..no clue.
dim o as object
o = me
in a Form shows "rootnamespace.form1" in the "name" column and "Object" in
the "Type" column. When clicking the [+], the next line also shows
"rootnamespace.form1" in the "Type" column.
VB 2003 BTW
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
"Klaus Löffelmann" <fo***********@loeffelmann.de> schrieb How do you get System.RuntimeType? If o.GetType.Fullname returns <yourclass>, it's ok, so o.GetType returns Gettype(yourclass) which is the type object representing your type.
In the local/auto window it says "System.RuntimeType" for the type of o, but you're right, though: If I test it, then
TypeOf o is <yourclass>
returns True.
So, what's the deal with System.RuntimeType, anyway?
Hmmm..no clue.
dim o as object
o = me
in a Form shows "rootnamespace.form1" in the "name" column and "Object" in
the "Type" column. When clicking the [+], the next line also shows
"rootnamespace.form1" in the "Type" column.
VB 2003 BTW
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Steve |
last post by:
Is there a way to dynamically inspect a type for the operators it
implements, and then compare two objects implementing that type?
Basically I'm looking at a situation where I receive two...
|
by: Klaus Löffelmann |
last post by:
Hello,
Assume, I got an instance of a certain class that is boxed in an object. How
can I retrieve the type of the original class only using this object. The
type I get with GetType is always...
|
by: AMDRIT |
last post by:
I would like to cast an object to a value type specified by a variable of
Type
Function ReturnTest(InputVar as Object) as Object
Dim DataType as Type = GetType(System.String)
If TypeOf...
|
by: Just D |
last post by:
All,
It was possible before in Pascal, C++, etc. to define our custom data type
or redefine the existing type, like in Turbo Pascal we could assume that
shortint is int and use all references to...
|
by: J055 |
last post by:
Hi
I have an OrderedDictionary object where the key is an enum. Is there an
easy way to cast it to an integer? Examples/document appreciated.
Thanks
Andrew
| |
by: garyusenet |
last post by:
I'm using an example piece of code: -
namespace Wintellect.Interop.Sound{
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
sealed class Sound{
public static...
|
by: Brad Pears |
last post by:
I am using a function called "CreateSQLParam" which adds SQL parameters to a
collection.
The function is shown below... I add a parameter to a collection using the
following line code...
...
|
by: Brette.Net |
last post by:
Hello All,
I was doing a little messing around with some type conversion they
other day. Code is below.
struct ValueStruct
{
int a;
public ValueStruct(int inA)
|
by: GeezerButler |
last post by:
For any given type i want to know its default value.
There is a neat keyword called default for doing this like
object x = default(DateTime);
but I have an instance of Type (called someType) and...
|
by: jehugaleahsa |
last post by:
Hello:
I would like to get default(T). However, I don't know what T is until
runtime; I just have a Type. Is there an equivilent means of getting
the results of default(T)?
Thanks,
Travis
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |