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

IsValueType

Apparently I don't understand the IsValueType property....

I am looping through the Cache and trying to determine if the object derives
from System.ValueType:

Dim CacheEnum As IDictionairyEnumerator = Cache.GetEnumerator()
While CacheEnum.MoveNext()
displayType(CacheEnum.Current.Value.GetType)
End While

Private Sub displayType(ByVal t as Type)
Response.write(t.IsValueType.ToString)
Response.write(t.BaseType.IsValueType.ToString)
End Sub

Now I just tried using the t.BaseType.IsValueType and t.IsValueType, but
they always return false.
Why is this?
I am putting Strings and Integers into the Cache. What am I doing wrong?
Nov 21 '05 #1
2 2505
Never mind.....I guess I am retarded.
The integer is performing as expected....
And now that I think of it...I guess the String should work. Isn't that a
mutable type or something?
"Brian Linden" <bl*****@gmail.com> wrote in message
news:OZ****************@TK2MSFTNGP12.phx.gbl...
Apparently I don't understand the IsValueType property....

I am looping through the Cache and trying to determine if the object derives from System.ValueType:

Dim CacheEnum As IDictionairyEnumerator = Cache.GetEnumerator()
While CacheEnum.MoveNext()
displayType(CacheEnum.Current.Value.GetType)
End While

Private Sub displayType(ByVal t as Type)
Response.write(t.IsValueType.ToString)
Response.write(t.BaseType.IsValueType.ToString)
End Sub

Now I just tried using the t.BaseType.IsValueType and t.IsValueType, but
they always return false.
Why is this?
I am putting Strings and Integers into the Cache. What am I doing wrong?

Nov 21 '05 #2
And now that I think of it...I guess the String should work. Isn't that a
mutable type or something?


It works if IsValueType returns false, because String is an immutable
reference type.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 21 '05 #3

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

Similar topics

4
by: Ole Andre Karlson | last post by:
hi Still struggeling with Gyro... :) how can this be correct? T t = null; gives a compile error because the compiler thinks T is a value type.
14
by: tshad | last post by:
I have people telling me that I should set up objects for my tables, but I am finding the Null problem makes that difficult. It isn't a big problem if you are not updating the table, but if you...
10
by: Qwert | last post by:
Hello, is it correct that if a type (System.Type) is a value (.IsValueType=True) and not primitive (.IsPrimitive=False), that type is a structure? Thanks.
2
by: INeedADip | last post by:
What I am trying to do is loop through all my session variables and log them if there is an exception. I want to loop through and, if they're a value type, I want to add them to a...
3
by: INeedADip | last post by:
What I am trying to do is a sort of Recursion "search" or listing of all the properties of a type. If I have a class that looks like: public class MyClass { private string _name = "jeff";...
10
by: Pierre Arnaud | last post by:
I'd like to provide two generic methods with the same name and the same arguments, but with different constraints, such as: void Explore<T>(T a, T b) where T : struct { } void Explore<T>(T a, T...
4
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)
2
by: jon.rea | last post by:
Please tell me there is a better way :-D .... public static bool IsNullableType(Type paramType) { return paramType.IsGenericType && paramType.GetGenericTypeDefinition() == typeof...
0
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
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...
1
isladogs
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...
0
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...
1
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)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.