I can't seem to JSON-deserialize classes that inherit from List<>
{although List<> works fine}. Skipping along,
JavaScriptDeserializer.DeserializeInternal() seems to do the following:
if (typeof(List<>).IsAssignableFrom(type.GetGenericTypeDefinition()) &&
...){...}
As far as I can tell, parameterless generic Types cannot be accurately
evaluated using isSubclass, isAssignableFrom, etc.:
class B<T> { };
class D<T> : B<T> { };
typeof(B<>).IsAssignableFrom(typeof(D<>)) //false
typeof(B<int>).IsAssignableFrom(typeof(D<int>)) //true
I propose the unhappy solution of using a known type as the compare
parameter:
Type[] typeArgs = {typeof(int)};
Type DofInt =
typeof(D<>).GetGenericTypeDefinition().MakeGenericType(typeArgs);
typeof(B<int>).IsAssignableFrom(DofInt) //true
Clearly, I'm no expert on this. Please correct me if my error analysis
is off target.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ajax.NET Professional" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/ajaxpro
The latest downloads of Ajax.NET Professional can be found at
http://www.ajaxpro.info
-~----------~----~----~----~------~----~------~--~---