polenter / SharpSerializer

SharpSerializer can serialize types like: multidimensional array, nested array, array-of-arrays, polymorphic object (where value is inherited from the property type), generic type, generic listing (i.e. dictionary, collection) and many more, with a single line of code

Home Page:https://www.sharpserializer.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SharpSerializer Is failing when object has non existing properties

dmitry-web opened this issue · comments

SharpSerializer Is failing when object has non existing properties.
Just need to check if Dictionary has key line code here

commented

How fix it?

How fix it?

Try to override SharpSerializer with your classes and check if key exists
return _objectCache.Any(x => x.Key == referenceTarget.Reference.Id) ? _objectCache[referenceTarget.Reference.Id] : null;