fastBinaryJSON
fastBinaryJSON copied to clipboard
Added support for deserializing properties/fields of collection interfaces
Thanks!
Personally I would cache the MakeGenericType
since it is a performance hog, have you tested the performance?
No, not yet. I will take a look at the performance next week.
Did you get any timing difference?
Also instead of Tuple
try using a struct
In my own project I'm using C#7 System.ValueTuple (which is a struct), but I don't know what the minimum c# / .net version is that should be supported. I found that with some additions, it could work for .NET 4.0, but I'm not sure about IDE support. I'll just add a custom struct instead to be sure I'm not using language features that are 'too new'.
(I have not tested if caching improves performance, but I'm quite confident a dictionary lookup will be faster than repeated calls to MakeGenericType. However, it will only make a difference when the type is used more than once, of course. I could also make the dictionary creation lazy, as it won't always be used. )
Note: ~~there's still a bug when deserializing ISet<T>: An instance of List<T> is used, bypassing the type system as IL is used in the setter, causing EntryPointNotFoundException to be thrown when accessing members of ISet<T>. (also none of the ISet<T> implementations are supported such as HashSet<T> and OrderedSet<T> )~~ Edit: this is now resolved with commit e015487
Sorry for the delay in resolving the conflicts. I switched jobs in the meantime and just found I had something unfinished. (I could not test if my changes still work after any changes on master in the meantime, but I did my best adjusting it just looking at the code )