Class SessionExtensions
Provides extension methods for types implementing ISession.
Inherited Members
Namespace: EmbedIO.Sessions
Syntax
public static class SessionExtensions
Methods
GetOrDefault<T>(ISession, String)
Gets the value associated with the specified key.
Declaration
public static T GetOrDefault<T>(this ISession this, string key)
Parameters
Type | Name | Description |
---|---|---|
ISession | this | The ISession on which this method is called. |
String | key | The key whose value to get from the session. |
Returns
Type | Description |
---|---|
T | The value associated with the specified key,
if the key is found and the associated value is of type |
Type Parameters
Name | Description |
---|---|
T | The desired type of the value. |
GetOrDefault<T>(ISession, String, T)
Gets the value associated with the specified key.
Declaration
public static T GetOrDefault<T>(this ISession this, string key, T defaultValue)
Parameters
Type | Name | Description |
---|---|---|
ISession | this | The ISession on which this method is called. |
String | key | The key whose value to get from the session. |
T | defaultValue | The default value to return if the key is not found
or its associated value is not of type |
Returns
Type | Description |
---|---|
T | The value associated with the specified key,
if the key is found and the associated value is of type |
Type Parameters
Name | Description |
---|---|
T | The desired type of the value. |
TryGet<T>(ISession, String, out T)
Gets the value associated with the specified key.
Declaration
public static bool TryGet<T>(this ISession this, string key, out T value)
Parameters
Type | Name | Description |
---|---|---|
ISession | this | The ISession on which this method is called. |
String | key | The key whose value to get from the session. |
T | value | When this method returns, the value associated with the specified key,
if the key is found and the associated value is of type This parameter is passed uninitialized. |
Returns
Type | Description |
---|---|
Boolean | true if the key is found and the associated value is of type |
Type Parameters
Name | Description |
---|---|
T | The desired type of the value. |