/// <summary> /// Generate a comma-delimited string containing a list of the file extensions that are in the specified filenames. /// If more than one filename has the same extension, the extension is listed just once in the output. /// </summary> /// <param name="filenames">A list of filenames.</param> /// <returns>Returns a comma-delimited string containing a list of the file extensions that are in the specified filenames.</returns> private static string GetFileExtensions(System.Collections.Specialized.StringCollection filenames) { System.Configuration.CommaDelimitedStringCollection fileExts = new System.Configuration.CommaDelimitedStringCollection(); foreach (string filename in filenames) { string fileExt = System.IO.Path.GetExtension(filename); if (!fileExts.Contains(fileExt)) { fileExts.Add(fileExt); } } return(fileExts.ToString()); }
/// <summary> /// Generate a comma-delimited string containing a list of the file extensions that are in the specified filenames. /// If more than one filename has the same extension, the extension is listed just once in the output. /// </summary> /// <param name="filenames">A list of filenames.</param> /// <returns>Returns a comma-delimited string containing a list of the file extensions that are in the specified filenames.</returns> private static string GetFileExtensions(System.Collections.Specialized.StringCollection filenames) { System.Configuration.CommaDelimitedStringCollection fileExts = new System.Configuration.CommaDelimitedStringCollection(); foreach (string filename in filenames) { string fileExt = System.IO.Path.GetExtension(filename); if (!fileExts.Contains(fileExt)) { fileExts.Add(fileExt); } } return fileExts.ToString(); }
private void RemoveReadyRedlineCategory(MailItem mailitem) { if (mailitem.Categories == null) return; // Remove the redline category, from any possible position in the (comma separated) string var csv = new System.Configuration.CommaDelimitedStringCollection(); csv.AddRange(mailitem.Categories.Split(',')); csv.Remove(Interop.Options.OptionApi.GetString("ReadyRedlineCategoryName")); mailitem.Categories = csv.ToString() ?? string.Empty; }