public static void LoadFileIntoList(TextAsset ass, List <DiaNodeMold> NodeListToFill, List <DiaNodeList> ListListToFill, DiaNodeType NodesType) { XPathNavigator xPathNavigator = new XPathDocument(new StringReader(ass.text)).CreateNavigator(); xPathNavigator.MoveToFirst(); xPathNavigator.MoveToFirstChild(); foreach (XPathNavigator item2 in xPathNavigator.Select("Node")) { try { TextReader textReader = new StringReader(item2.OuterXml); DiaNodeMold diaNodeMold = (DiaNodeMold) new XmlSerializer(typeof(DiaNodeMold)).Deserialize(textReader); diaNodeMold.nodeType = NodesType; NodeListToFill.Add(diaNodeMold); textReader.Dispose(); } catch (Exception ex) { Log.Message("Exception deserializing " + item2.OuterXml + ":\n" + ex.InnerException); } } foreach (XPathNavigator item3 in xPathNavigator.Select("NodeList")) { try { TextReader textReader2 = new StringReader(item3.OuterXml); DiaNodeList item = (DiaNodeList) new XmlSerializer(typeof(DiaNodeList)).Deserialize(textReader2); ListListToFill.Add(item); } catch (Exception ex2) { Log.Message("Exception deserializing " + item3.OuterXml + ":\n" + ex2.InnerException); } } }