You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
in the public static bool Retrieve(out TSettings result, string namePreFix = null, string nameMarker = null) function
if (File.Exists(fileName))
{
result = new TSettings();
string text = null;
text = File.ReadAllText(fileName);
result = JsonConvert.DeserializeObject(text,
new JsonSerializerSettings
{
TypeNameHandling = TypeNameHandling.Auto,
TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple,
PreserveReferencesHandling = PreserveReferencesHandling.All,
CheckAdditionalContent = false
}) as TSettings;
if (result == null)
result = new TSettings();
return true;
}
i think having: result = new TSettings();
at the first line of the if, will lead to un-used object, as it will go to garbage collector if the 'DeserializeObject' works, and its enough to have the lines:
if (result == null)
result = new TSettings();
I think that the line: result = JsonConvert.DeserializeObject(text,
should be: result = JsonConvert.DeserializeObject**<TSettings>**(text,
Regards.
The text was updated successfully, but these errors were encountered:
in the public static bool Retrieve(out TSettings result, string namePreFix = null, string nameMarker = null) function
result = new TSettings();
at the first line of the if, will lead to un-used object, as it will go to garbage collector if the 'DeserializeObject' works, and its enough to have the lines:
result = JsonConvert.DeserializeObject(text,
should be:
result = JsonConvert.DeserializeObject**<TSettings>**(text,
Regards.
The text was updated successfully, but these errors were encountered: