7e6194b61b62be27e40a1e3745a854f5a514e356
GetValueOrDefault() is an easily-inlined access to a field as this will hold the correct value for both HasValue and !HasValue cases. The Value property in comparison contains a branch on a check that the Nullable<T> has its internal hasValue flag to decide whether to throw InvalidOperationException or not. Hence when a nullable type is known to have a value (not be null) and one wants the value, rather than to possibly trigger the exception-throw GetValueOrDefault() has a slight performance benefit over Value. Accordingly, replace calls to the Value property with calls to GetValueOrDefault() when previous checks or assignments guarantee the value is not null.
Description
Json.NET 是一种适用于 .NET 的常用高性能 JSON 框架
https://github.com/JamesNK/Newtonsoft.Json.git
27 MiB
Languages
C#
99.3%
PowerShell
0.7%