src/packages/EmbedIO/Sessions/SessionExtensions.cs
/// <summary>Gets the value associated with the specified key.</summary>
/// <typeparam name="T">The desired type of the value.</typeparam>
/// <param name="this">The <see cref="ISession"/> on which this method is called.</param>
/// <param name="key">The key whose value to get from the session.</param>
/// <param name="value">
/// <para>When this method returns, the value associated with the specified key,
/// if the key is found and the associated value is of type <typeparamref name="T"/>;
/// otherwise, the default value for <typeparamref name="T"/>.</para>
/// <para>This parameter is passed uninitialized.</para>
/// </param>
/// <returns><see langword="true"/> if the key is found and the associated value is of type <typeparamref name="T"/>;
/// otherwise, <see langword="false"/>.</returns>
/// <exception cref="NullReferenceException"><paramref name="this"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentNullException"><paramref name="key"/> is <see langword="null"/>.</exception>
Gets the value associated with the specified key.
Gets the value associated with the specified key .
public static bool TryGet<T>(this ISession @this, string key, out T value)
        {
            if (@this.TryGetValue(key, out var foundValue) && foundValue is T typedValue)
            {
                value = typedValue;
                return true;
            }
#pragma warning disable CS8653 
            value = default;
#pragma warning restore CS8653
            return false;
        }
public static bool TryGet < T > ( this ISession @this , string key , out T value ) { if ( @this . TryGetValue ( key , out var foundValue ) && foundValue is T typedValue ) { value = typedValue ; return true ; } pragma warning disable CS8653 value = default ; pragma warning restore CS8653 return false ; }
Gets the value associated with the specified key.
Gets the value associated with the specified key .
// "default" can be null - We are returning false, so value is undefined
if the key is found and the associated value is of type ;
otherwise, .
if the key is found and the associated value is of type ; otherwise .
None
None
ISession
this
key
string
The key whose value to get from the session.
The key whose value to get from the session .
T
out
this
The  on which this method is called.
The on which this method is called .
value
When this method returns, the value associated with the specified key,
if the key is found and the associated value is of type ;
otherwise, the default value for .This parameter is passed uninitialized.
When this method returns the value associated with the specified key if the key is found and the associated value is of type ; otherwise the default value for . This parameter is passed uninitialized .
typeparam
The desired type of the value.
The desired type of the value .