private static void AddDocument(Document doc, string[] attributes) { foreach (var attribute in attributes) { var tokens = attribute.Split('='); var propName = tokens[0]; var propValue = tokens[1]; doc.LoadProperty(propName, propValue); } if (doc.Name != null) { documents.Add(doc); Console.WriteLine("Document added: {0}", doc.Name); } else { Console.WriteLine("Document has no name"); } }
private static void AddNewDocument(Document document, string[] attributes) { string[] keyAndValue; foreach (string attribute in attributes) { keyAndValue = attribute.Split('='); document.LoadProperty(keyAndValue[0], keyAndValue[1]); } if (document.Name != null) { documents.Add(document); Console.WriteLine("Document added: " + document.Name); } else { Console.WriteLine("Document has no name"); } }