Set(T) Method

Glimpse API

DataStoreExtensions Set T  Method Glimpse API Documentation
Sets an item in store using <T> as a key. This method should be used in combination with Get<T>.

Namespace: Glimpse.Core.Extensions
Assembly: Glimpse.Core (in Glimpse.Core.dll) Version: 1.0.1.0 (1.0.1)

Syntax

public static void Set<T>(
	this IDataStore store,
	T value
)
public static void Set<T>(
	this IDataStore store,
	T value
)

Parameters

store
Type: Glimpse.Core.Extensibility IDataStore
The data store instance.
value
Type: T
The item to store.
Type Parameters

T
The type of item to set.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IDataStore. When you use instance method syntax to call this method, omit the first parameter. For more information, see OnlineExtension Methods (Visual Basic) or OnlineExtension Methods (C# Programming Guide).
Examples

dataStore.Set("I am a string"); // inferred type 
var result = dataStore.Get<string>();
Assert.Equals(result, "I am a string");

dataStore.Set<IList<int>>(new List{ 1, 2, 3 }); // specified type 
var result = dataStore.Get<IList<int>>();
Assert.Equals(result.Count, 3);
dataStore.Set("I am a string"); // inferred type 
var result = dataStore.Get<string>();
Assert.Equals(result, "I am a string");

dataStore.Set<IList<int>>(new List{ 1, 2, 3 }); // specified type 
var result = dataStore.Get<IList<int>>();
Assert.Equals(result.Count, 3);
See Also