1

I am developing an application for windows phone 7.I want to make my application persist-able so that I can restore my application after restart.

but the problem is that I have some func<> delegates members which are ,dynamically pointing to some functions ,in some of Class objects which I want to persist.

Actually I am serializing my func<> delegate member  using [datamember] attribute
and deserializeing it to persist state.

And I don not know whether they are persist-able or not in Wp7.

I know that it is persist-able in WPF.I read few articles and it seems it is not persist-able in WP7.

And What is an alternative for func<> if it is not persist-able in WP7.

rakesh
  • 602
  • 1
  • 5
  • 23
  • Are you saying you assign `Func<>`s to a member dynamically and want to (de)serialise to persist state? Are you creating the `Func<>`s dynamically, because if not could you just have an enum or something that dicates which `Func<>` you're using and save/restore that? – George Duckett Feb 03 '12 at 11:56
  • What do you mean by persist-able? Serializable? You can use the Isolated Storage to save serialized objects. http://msdn.microsoft.com/en-us/library/ff402541(v=vs.92).aspx You can implement ISerializable or IXmlSeriazible on your object and build up the method references when you deserialize or in the constructor of your class. Can you please extend your question a bit and add more details? – Jeno Laszlo Feb 03 '12 at 11:59
  • He most likely just have a tombstoning problem, but he is having language barrier issues. – Claus Jørgensen Feb 03 '12 at 12:03
  • 1
    @GeorgeDuckett sir you are right I am assigning a Func<>to a member dynamically And want to serialize and deserialize to persist state. – rakesh Feb 03 '12 at 12:06
  • 2
    The key question then, is, how are you assigning something to your `Func<>` member? Find a way to (de)serialise information needed to recreate that process, rather than serialising the Func its self. i.e. with an enum / index into array of predefined Funcs etc. – George Duckett Feb 03 '12 at 12:11

1 Answers1

1

You can serialize the delegates, but it is a bit risky cause only the compiler generated name is saved.

Look at this example

Community
  • 1
  • 1
Kolja
  • 2,307
  • 15
  • 23