title: Inject SessionExtensions Asp.net Core
body: <p>I am using the below class named SessionExtensions to set and get complex object (User Class)</p>
  
  <pre><code>public static class SessionExtensions
      {
          public static void Set&lt;T&gt;(this ISession session, string key, T value)
          {
              session.SetString(key, JsonSerializer.Serialize(value));
          }
  
          public static T Get&lt;T&gt;(this ISession session, string key)
          {
              var value = session.GetString(key);
              return value == null ? default : JsonSerializer.Deserialize&lt;T&gt;(value);
          }
      }
  </code></pre>
  
  <p>I am trying to inject it into a view to display the first and last name of a user but all examples are using <code>Session.GetString</code> instead of <code>Get&lt;User&gt;</code></p>
  
  <p>Thanks</p>