public static List <int> getFundIDs(Fund funds) { List <int> fundIDs = new List <int>(); if (funds != null) { foreach (int id in funds.Funds) { fundIDs.Add(id); } return(fundIDs); } else { return(null); } }
public static List <int> getFundState() { try { if (!FileLocation.Contains(".xml")) { FileLocation = FileLocation + fileName + ".xml"; } using (StreamReader objectReader = new StreamReader(@FileLocation)) { outputManager = new XmlSerializer(typeof(Fund)); Fund funds = new Fund(); funds = (Fund)outputManager.Deserialize(objectReader); return(getFundIDs(funds)); } } catch (Exception e) { return(null); } }