public static T Get <T>(this PropertyBagAdapter properties, string key, T defaultValue = default(T)) { var result = properties.Get(key); if (result != null) { return((T)result); } return(defaultValue); }
public void PropertyBagAdapter_Get_CanAccessKeysFromSourceIPropertyBag() { Assert.AreEqual("val1", _adapter.Get("key")); Assert.AreEqual(42, _adapter.Get("meaningOfLife")); Assert.AreEqual(null, _adapter.Get("nonExistantKey")); }