Skip to content
This repository was archived by the owner on Jul 15, 2023. It is now read-only.

Conversation

@twsouthwick
Copy link
Member

This converter is used to create Version and FrameworkName instances which are a small set of known values in the assembly. This caches them so that we can reuse them when creating them.

@twsouthwick twsouthwick changed the title Set up some caching in json conversion Cache Version and FrameworkName in json deserialization Jul 10, 2019
var value = serializer.Deserialize<JToken>(reader).ToString();

return string.IsNullOrEmpty(value) ? default(T) : _factory(value);
return string.IsNullOrEmpty(value) ? default : _cache.GetOrAdd(value, _factory);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still want "default(T)" instead of "default", right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Lxiamail Lxiamail requested a review from marklio July 11, 2019 16:45
@twsouthwick twsouthwick merged commit fa58f04 into microsoft:dev Jul 11, 2019
@twsouthwick twsouthwick deleted the cached-json branch July 11, 2019 20:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants