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

Undocmumented Class System.RuntimeType

Heya,

I am looking for information about the System.RuntimeType and other Runtime
classes. They are undocumented in my version of Visual Studio. So far I have
no luck with internet, only some remarks:

- All .NET classes are instances of System.RuntimeType.

- RuntimeType is the basic Type object representing classes as found in the
system.

- This type is never creatable by users, only by the system itself.

- The internal structure is known about by the runtime.

- __RuntimeXXX classes are created only once per object in the system and
support == comparisions.
Any links would be helpfull,

Thanks.
Nov 21 '05 #1
4 6900
Hi,
These remarks that you have posted have been taken from rotor
\sscli\clr\src\bcl\system\runtimetype.cs? You can look at different places
in Rotor for RuntimeType and will find a lot of comments that may help
understanding more about it.

Ab.
http://joehacker.blogspot.com

"Stofdeel" <NO****@NOSPAM.nl> wrote in message
news:ZM********************@casema.nl...
Heya,

I am looking for information about the System.RuntimeType and other
Runtime
classes. They are undocumented in my version of Visual Studio. So far I
have
no luck with internet, only some remarks:

- All .NET classes are instances of System.RuntimeType.

- RuntimeType is the basic Type object representing classes as found in
the
system.

- This type is never creatable by users, only by the system itself.

- The internal structure is known about by the runtime.

- __RuntimeXXX classes are created only once per object in the system and
support == comparisions.
Any links would be helpfull,

Thanks.

Nov 21 '05 #2
Stofdeel,
| I am looking for information about the System.RuntimeType and other
Runtime
| classes.
Why? System.RuntimeType is a specific implementation of System.Type. You
should be programming to the public "contract" of System.Type, not the
private implementation details of System.RuntimeType.

| They are undocumented in my version of Visual Studio. So far I have
| no luck with internet, only some remarks:
IMHO RuntimeType is undocumented as it is an implementation detail of the
Framework, i.e. it encapsulates the "runtime" implementation of a Type.
Remember that Encapsulation is one of the tenants of OO.

| - All .NET classes are instances of System.RuntimeType.
That is not really true, I would say most .NET System.Type instances are
instances of System.RuntimeType. I don't remember if when you load a type
for with System.Reflection if its still a System.RuntimeType or another
concrete Type. Although I don't have specific examples, I would expect there
may be other private specific implementations of System.Type, as System.Type
is MustInherit (abstract) after all.

In other words I would not (*do not*) expect that all System.Type variables
are of type System.RuntimeType.

| - RuntimeType is the basic Type object representing classes as found in
the
| system.
I would agree to a point, ergo an Encapsulated Implementation Detail. As I
suggested earlier I would program to System.Type and not be concerned with
what System.RuntimeType is.

For example: consider the System.IO.Stream.Null property. If you look at the
object return it has type System.IO.Stream.NullStream. NullStream is not
documented as it is an implementation detail of the Stream.Null property.
All one really needs to know is that Stream.Null returns an implementation
of Stream that behaves like a stream...

| - This type is never creatable by users, only by the system itself.
Again I would agree, ergo an Encapsulated Implementation Detail

| - __RuntimeXXX classes are created only once per object in the system
| and
| support == comparisons.
Do you mean reference equality (Is operator), or identity equality (=
operator). As == is an C# operator that could mean either.

I don't see that Identity equality is supported as: I don't see operator =
overloaded, nor System.Equals overridden, nor IComparable implement.
Of course reference equality is supported as specific types are effectively
singletons...
--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net
"Stofdeel" <NO****@NOSPAM.nl> wrote in message
news:ZM********************@casema.nl...
| Heya,
|
| I am looking for information about the System.RuntimeType and other
Runtime
| classes. They are undocumented in my version of Visual Studio. So far I
have
| no luck with internet, only some remarks:
|
| - All .NET classes are instances of System.RuntimeType.
|
| - RuntimeType is the basic Type object representing classes as found in
the
| system.
|
| - This type is never creatable by users, only by the system itself.
|
| - The internal structure is known about by the runtime.
|
| - __RuntimeXXX classes are created only once per object in the system and
| support == comparisions.
|
|
| Any links would be helpfull,
|
| Thanks.
|
|
Nov 21 '05 #3
Thanks all for the replies.
| I am looking for information about the System.RuntimeType and other
Runtime
| classes.
Why? System.RuntimeType is a specific implementation of System.Type. You
should be programming to the public "contract" of System.Type, not the
private implementation details of System.RuntimeType.


The code should be able to recognize them:

Public Sub Test(objType As System.Type)
If type = RuntimeType or other RuntimeXXX type then
"Nope, can't do, go away."
End If
End Sub

Nov 21 '05 #4
Qwert,
| The code should be able to recognize them:
| If type = RuntimeType or other RuntimeXXX type then
If you really want to rely on an implementation detail, then you could use a
string comparison.

If type.ToString = "String.RuntimeType"

However I still question why! As relying on implementation details usually
creates fragile code.

About the only time I would care if its a runtime type or not, is when I
have introduced specific Type types. And I need to operate specifically on
my specific Type types. In which case rather then check for RuntimeType,
which I don't know about, I would be checking for my specific Type types.
This way if others create specific Type types I don't need to change the
logic to include those types also...

--
Hope this helps
Jay [MVP - Outlook]
T.S. Bradley - http://www.tsbradley.net
"Qwert" <no**@nosp.com> wrote in message
news:Nd********************@casema.nl...
| Thanks all for the replies.
|
| > | I am looking for information about the System.RuntimeType and other
| > Runtime
| > | classes.
| > Why? System.RuntimeType is a specific implementation of System.Type. You
| > should be programming to the public "contract" of System.Type, not the
| > private implementation details of System.RuntimeType.
|
| The code should be able to recognize them:
|
| Public Sub Test(objType As System.Type)
| If type = RuntimeType or other RuntimeXXX type then
| "Nope, can't do, go away."
| End If
| End Sub
|
|
|
|
|
Nov 21 '05 #5

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

Similar topics

2
by: Sanddevil | last post by:
Hi there - I hope someone out there can help me! I'm using a .Net DataGrid Class to show the results of a SQL query in a spreadsheet type control. The code, which works fine is: iRowCount =...
1
by: Merlynx | last post by:
i am getting that error with the Event() method. Don't know whether if i have used the CreateEvent function well as it is the 1st time i used it moreover i am net to C#. If anyone can point me out...
3
by: Mike in Paradise | last post by:
I have an application that is being passed objects which could either be an instance or a Type in the case of a Static Class When you do the GetType on the object that was originally a Static...
1
by: Bob of the West | last post by:
Hi, I'm trying to something quite straightforward, populate a datagrid with certain fields after selecting from a dropdownlist. The books I have don't seem to give an example of how to do this (...
0
by: Jason Garland \(Secure Access Pty Ltd\) | last post by:
Any ideas on how to cure the following error ? The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes...
2
by: Ryan | last post by:
Hi, I receive an access denied error (see below) when attempting to send an email with BodyFormat=MailFormat.Html from an asp.net page. Exactly the same code works fine in a console...
1
by: jimmyfo | last post by:
Hi, I recently wrote an ASP.Net web application in VS2005 and published (using VS2005 Publish feature) it to a relatively clean machine with ASP.Net 2.0 and MDAC 2.8 installed on it. However, when...
0
by: =?ISO-8859-1?Q?J=FCrgen_B=F6hm?= | last post by:
Hello, (I already posted this at comp.lang.c++.moderated, but received no answers, maybe it is better placed here?): to implement a little symbolic computation system, dealing with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
Oralloy
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,...
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
agi2029
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 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.