/// <summary> /// Write all Fullnames in the supplied FullnameCollection to a file. /// </summary> /// <param name="path"></param> /// <returns></returns> public void WriteToFile(FullnameCollection collection, string path) { using (System.IO.StreamWriter outputStream = new System.IO.StreamWriter(path)) { WriteToStream(collection, outputStream); } }
/// <summary> /// Write all Fullnames in the supplied FullnameCollection to a Streamwriter /// </summary> /// <param name="stream">Streamwriter to write all Fullnames to.</param> public void WriteToStream(FullnameCollection collection, System.IO.TextWriter stream) { // get each Fullname and output each to the stream. foreach (var name in collection) { stream.WriteLine(name.ToString()); } }
/// <summary> /// Create new FullnameCollection with names sorted from supplied FullnameCollection /// </summary> /// <param name="fullnameCollection"></param> /// <returns>new FullnameCollection</returns> public FullnameCollection SortByLastnameGivenname(FullnameCollection fullnameCollection) { var sortedNames = fullnameCollection.OrderBy(x => x.Lastname + x.Givennames).ToList(); return(new FullnameCollection(sortedNames)); }