I have a problem very similar (but not quite the same) as serialization of
singletons...e.g.

with a singleton, you serialise it, deserialise it, and now effectively
have a clone of the original.....well documented and I know how to get
around it (even if I don't understand exactly the dot net serialisation
mechanism).

My problem is similar, I have a set of objects that are created via a
factory and are unique for their specific state.....so for example if the
class was

class Person
{
   public Person(string name);
}

class PersonFactory
{
   IDictionary<string,Person> uniquePeople = ...bla bla

   Person GetPerson(string name)
   {
      if (!uniquePeople.ContainsKey(name))
      {
         uniquePeople.Add(name, new Person(name));
      }

      return uniquePeople[name];
   }
}


The examples of how to handle singletons don't explain how to handle
state......i.e. as it's a singleton, the state is the state of the
singleton currently in memory.

Can you help?

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to