IsValueType

  • Thread starter Thread starter Brian Linden
  • Start date Start date
B

Brian Linden

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?
 
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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top