[hyena] [Hyena] Add Get with fallback to PropertyStore



commit d56839c38ff03c9b043867edc4a7c239c27ada26
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Tue Aug 24 13:03:05 2010 -0500

    [Hyena] Add Get with fallback to PropertyStore

 Hyena/Hyena.Data/PropertyStore.cs |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/Hyena/Hyena.Data/PropertyStore.cs b/Hyena/Hyena.Data/PropertyStore.cs
index 60a5af8..652408f 100644
--- a/Hyena/Hyena.Data/PropertyStore.cs
+++ b/Hyena/Hyena.Data/PropertyStore.cs
@@ -163,6 +163,17 @@ namespace Hyena.Data
             }
         }
 
+        public T Get<T>(string name, T fallback)
+        {
+            lock(this) {
+                if(object_store != null && object_store.ContainsKey(name)) {
+                    return (T)object_store[name];
+                }
+
+                return fallback;
+            }
+        }
+
         public int GetInteger(string name)
         {
             return Get<int>(name);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]