Deserialize

Alexthemaster

New member
Joined
Dec 15, 2008
Messages
4
Hi,
Anyone knows in what kind of object i can put my deserialized file...?
Ive serialized the file with a Class Film and now I want to deserialize it.
Code:
        List<Accounttemplate> ac = new List<Accounttemplate>();
        public List<Accounttemplate> FindAcc()
        {            
FileStream fs = new FileStream(@"/Accounts.xml",    FileMode.OpenOrCreate, FileAccess.Read);
            XmlSerializer sr = new XmlSerializer(typeof(Accounttemplate));
        // I want to put this in an object so i can return it and then put the List in a Datagrid view.
sr.Deserialize(fs);
        fs.Close();
 
You can try this

Code:
List<Accounttemplate> listReturn = new List<Accounttemplate>();
listReturn = (List<Accounttemplate>)sr.Deserialize(fs);
 
Thanks a lot, it works:) , i had tryed to cast it into a couple of other things before but couldnt find one that worked.
 
Back
Top