NamespaceSystemLibrary.Common.Net.Extensions SystemLibrary.Common.Net.dll
ConcurrentDictionaryExtensions
public static class ConcurrentDictionaryExtensions
Inheritance
Examples
Arguments
Methods
Try Get the item from the dictionary
If item is not in dictionary, the method getItem is invoked and result is added to dictionary and returned
NOTE: This is a static cache, objects lives as long as application runs in a thread-safe manner
NOTE 2: Item limit per dictionary is 100K before it is emptied and started over again
public static T TryGet<T>(this ConcurrentDictionary<int, T> dictionary, int key, Func<T> getItem)
Generic types
Name | Description |
---|---|
T |
Methods arguments
Type | Name | Description |
---|---|---|
System.Collections.Concurrent.ConcurrentDictionary<System.Int32, T> | dictionary | |
System.Int32 | key | |
System.Func<T> | getItem |
Type | Description |
---|---|
T |
Try Get the item from the dictionary
If item is not in dictionary, the method getItem is invoked and result is added to dictionary and returned
NOTE: This is a static cache, objects lives as long as application runs in a thread-safe manner
NOTE 2: Item limit per dictionary is 100K before it is emptied and started over again
public static T TryGet<T>(this ConcurrentDictionary<int, T> dictionary, Type type, Func<T> getItem)
Generic types
Name | Description |
---|---|
T |
Methods arguments
Type | Name | Description |
---|---|---|
System.Collections.Concurrent.ConcurrentDictionary<System.Int32, T> | dictionary | |
System.Type | type | |
System.Func<T> | getItem |
Type | Description |
---|---|
T |
Try Get the item from the dictionary
If item is not in dictionary, the method getItem is invoked and result is added to dictionary and returned
NOTE: This is a static cache, objects lives as long as application runs in a thread-safe manner
NOTE 2: Item limit per dictionary is 100K before it is emptied and started over again
public static T TryGet<T>(this ConcurrentDictionary<string, T> dictionary, string key, Func<T> getItem)
Generic types
Name | Description |
---|---|
T |
Methods arguments
Type | Name | Description |
---|---|---|
System.Collections.Concurrent.ConcurrentDictionary<System.String, T> | dictionary | |
System.String | key | |
System.Func<T> | getItem |
Type | Description |
---|---|
T |
}