Skip to content

Instantly share code, notes, and snippets.

@xrisdoc
Created March 5, 2021 09:00
Show Gist options
  • Save xrisdoc/5449031d9ad6f40354069d8ca4596937 to your computer and use it in GitHub Desktop.
Save xrisdoc/5449031d9ad6f40354069d8ca4596937 to your computer and use it in GitHub Desktop.
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