In the Following the static class helpers that have been given is actually wrong in .net core 3.1 the string elements have been removed.
I have .net core 3.1 selection in the drop down menu and the statements are incorrect.
public static void Set<T>(this ISession session, string key, T value)
{
session.SetString(key, JsonSerializer.Serialize(value));
}
public static T Get<T>(this ISession session, string key)
{
var value = session.GetString(key);
return value == null ? default : JsonSerializer.Deserialize<T>(value);
}
It should be this but even then it complains and gives an error that it cannot convert from readonly type of byte.
public static void Set<T>(this ISession session, string key, T value) {
session.Set(key, JsonSerializer.Serialize(value));
}
public static T Get<T>(this ISession session, string key) {
var value = session.Get(key);
return value == null ? default : JsonSerializer.Deserialize<T>(value);
}
Error that is given is
Severity Code Description Project File Line Suppression State
Error CS0411 The type arguments for method 'Helpers.Get(ISession, string)' cannot be inferred from the usage. Try specifying the type arguments explicitly. ElectricalSurvey.DAL D:\GitMaster\sybersystemslimited\ElectricalSurvey\ElectricalSurvey\ElectricalSurvey.DAL\Helpers\Helpers.cs 19 Active
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
ID: 76e22150-f1f1-5e4f-0e97-39b1ac089297
Version Independent ID: 687172c3-b7d8-525d-39dc-658b4a0f526f
In the Following the static class helpers that have been given is actually wrong in .net core 3.1 the string elements have been removed.
I have .net core 3.1 selection in the drop down menu and the statements are incorrect.
It should be this but even then it complains and gives an error that it cannot convert from readonly type of byte.
Error that is given is
Severity Code Description Project File Line Suppression State Error CS0411 The type arguments for method 'Helpers.Get(ISession, string)' cannot be inferred from the usage. Try specifying the type arguments explicitly. ElectricalSurvey.DAL D:\GitMaster\sybersystemslimited\ElectricalSurvey\ElectricalSurvey\ElectricalSurvey.DAL\Helpers\Helpers.cs 19 Active
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.