[Solved] Create a class that will hold a LINQ query?

I am trying to select a row [and in a comment…] I was trying to get the whole row which has several data types. Then you don’t need to Cast() or ToList(). If you want a single record, just fetch that single matching record: return database.Staff_Mod_TBLs .Single(staff => staff.Staff_No == staffNo); or, if you want … Read more

[Solved] How to convert class Array to XML file in C# dynamically?

Instead of manually constructing the XML file, use a XML serializer instance. For it to correctly generate the structure, use a wrapper-class with decorated properties as follows: class XmlOrderTemplate { [XmlArray(“OrderTemplate”)] [XmlArrayItem(“Order”)] public List<OrderTemplate> Orders {get;set;} } using(var sw = new StreamWriter(fullPath)){ var serializer = new XmlSerializer(typeof(XmlOrderTemplate)); serializer.Serialize(sw, new XmlOrderTemplate {Orders = Data}); } 2 … Read more