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 2132
"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: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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: 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,...
| |