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 2131
"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: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |