1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
4 namespace System.Activities.Presentation.Internal.PropertyEditing.State
9 // Simple base class for persisted state objects so that we can reuse a chunk of the logic
10 // from one persistent state storage to another.
12 internal abstract class PersistedState
16 // Gets a value indicating whether the content of the state object is significant
17 // enough that it warrants serialization
19 public abstract bool IsSignificant
23 // Gets an object that we use as a key to key off this state instance
25 public abstract object Key
29 // Serializes this state into a string that can be persisted across app domains.
30 // If the content of this state is not significant enough to persist, null is returned.
32 // <returns>Serialization of this state object, or null if not significant enough.</returns>
33 public string Serialize()
35 return IsSignificant ? SerializeCore() : null;
39 // Serializes this object into a string.
41 // <returns>String representation of this object.</returns>
42 protected abstract string SerializeCore();