I am trying to save setting to SQL. It works fine until I recompile and then it falls apart.
Does anyone have an example of the GridSettingsPersister that uses the BinaryFormatter instead of the LosFormatter?
I am still unable to get the BinaryFormatter to work. Has anyone been able to get the GridSettingsPersister to work with the BinaryFormatter?
Does anyone have an example of the GridSettingsPersister that uses the BinaryFormatter instead of the LosFormatter?
I am still unable to get the BinaryFormatter to work. Has anyone been able to get the GridSettingsPersister to work with the BinaryFormatter?
public
override
string
ToString()
{
//LosFormatter formatter = new LosFormatter();
BinaryFormatter formatter =
new
BinaryFormatter();
//using (StringWriter writer = new StringWriter())
using
(MemoryStream writer =
new
MemoryStream())
{
formatter.Serialize(writer,
this
);
string
arr = writer.ToString();
return
arr.ToString();
}
}
/// <summary>
/// Gets the GridSettingsCollectionInstance from its serialized string data
/// </summary>
/// <param name="data">The object as serialized string data</param>
public
static
GridSettingsCollection LoadFromSerializedData(
string
data)
{
//LosFormatter formatter = new LosFormatter();
BinaryFormatter formatter =
new
BinaryFormatter();
byte
[] arr = System.Text.Encoding.ASCII.GetBytes(data);
MemoryStream stream =
new
MemoryStream(arr);
//return (GridSettingsCollection)formatter.Deserialize(data);
return
(GridSettingsCollection)formatter.Deserialize(stream);
}