Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[Serializable()]
public class MyObject
{
// members to be dispalyed in the listbox
}
[Serializable()]
public class MyList
{
ArrayList arr = new ArrayList(); // here will be stored the MyObject objects
}
//Create a MyList object:
MyList list = new MyList();
MyObject obj = new Myobject(...);
list.arr.Add(obj);
//Opens a file and serializes the object into it in binary format.
Stream stream = File.Open("listboxdata.xml", FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(stream, list);
stream.Close();
//Opens file "listboxdata.xml" and deserializes the object from it.
stream = File.Open("data.xml", FileMode.Open);
formatter = new BinaryFormatter();
MyList list = (MyList)formatter.Deserialize(stream);
stream.Close();
// Now use list object to populate the ListBox before dispalying it:
foreach (object obj in list.arr)
{
MyObject myobj= (MyObject)object;
// Add the myobj to the ListBox
}