W
WebBuilder451
I can very simple save a serilized class to a server, but i don't know how to
serilize an object (here a business object) to a variable so that it can be
saved to viewstate or passed to another page?
here is my to disk version:
private void ser()
{
var fs = new FileStream(@"e:\websites\SerializedClassData",
FileMode.Create);
// Create a BinaryFormatter object to perform the serialization
var bf = new BinaryFormatter();
var dt1 = DateTime.Now;
var dt2 = DateTime.Now;
DateTime.TryParse(ddlStart.SelectedValue, out dt1);
DateTime.TryParse(ddlEnd.SelectedValue, out dt2);
var AAIL = AAISummaryManager.GetList(dt1, dt2);
// Use the BinaryFormatter object to serialize the data to the file
var bcls = new object();
bf.Serialize(fs, AAIL);
// Close the file
fs.Close();
}
now how do i serilize to a variable?
thanks!!
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes
serilize an object (here a business object) to a variable so that it can be
saved to viewstate or passed to another page?
here is my to disk version:
private void ser()
{
var fs = new FileStream(@"e:\websites\SerializedClassData",
FileMode.Create);
// Create a BinaryFormatter object to perform the serialization
var bf = new BinaryFormatter();
var dt1 = DateTime.Now;
var dt2 = DateTime.Now;
DateTime.TryParse(ddlStart.SelectedValue, out dt1);
DateTime.TryParse(ddlEnd.SelectedValue, out dt2);
var AAIL = AAISummaryManager.GetList(dt1, dt2);
// Use the BinaryFormatter object to serialize the data to the file
var bcls = new object();
bf.Serialize(fs, AAIL);
// Close the file
fs.Close();
}
now how do i serilize to a variable?
thanks!!
--
(i''ll be asking a lot of these, but I find C# totally way cooler than vb
and there''s no go''n back!!!)
thanks (as always)
kes