Created
March 5, 2021 09:00
-
-
Save xrisdoc/5449031d9ad6f40354069d8ca4596937 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
namespace ADL.TechPubs | |
{ | |
public interface IApplicationItems : IDictionary<string, object> | |
{ | |
bool Exists(string key); | |
object Get(string key); | |
T Get<T>(string key) where T : class; | |
} | |
public class ApplicationItems : Dictionary<string, object>, IApplicationItems | |
{ | |
public ApplicationItems() | |
{ | |
} | |
public bool Exists(string key) | |
{ | |
return ContainsKey(key) && this[key] != null; | |
} | |
public object Get(string key) | |
{ | |
return Exists(key) ? this[key] : null; | |
} | |
public T Get<T>(string key) where T : class | |
{ | |
return Get(key) as T; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment