[blam] Make ItemStore a singleton



commit 1b083c7147f2e7482186af0cf5b413c25504500e
Author: Carlos Martín Nieto <carlos cmartin tk>
Date:   Wed Sep 15 02:38:53 2010 +0100

    Make ItemStore a singleton

 src/ItemStore.cs |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/ItemStore.cs b/src/ItemStore.cs
index 7bc5099..3955414 100644
--- a/src/ItemStore.cs
+++ b/src/ItemStore.cs
@@ -6,15 +6,26 @@ namespace Imendio.Blam
 {
     public class ItemStore
     {
-       Hashtable items;
+        Hashtable items;
+        ItemStore instance = null;
 
         void Add(SyndicationItem item)
         {
             items.Add(item.Id, item);
         }
 
-       public ItemStore ()
+        public ItemStore GetInstance()
+        {
+            if(instance == null){
+                instance = new ItemStore();
+            }
+
+            return instance;
+        }
+
+       private ItemStore ()
        {
+            items = new Hashtable();
        }
     }
 }



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