private CommandLineSwitch OutputFormatSwitch() { List <string> outputTypes = new List <string>(); foreach (var type in VirtualDisk.SupportedDiskTypes) { List <string> variants = new List <string>(VirtualDisk.GetSupportedDiskVariants(type)); if (variants.Count == 0) { outputTypes.Add(type.ToUpperInvariant()); } else { foreach (var variant in variants) { outputTypes.Add(type.ToUpperInvariant() + "-" + variant.ToLowerInvariant()); } } } string[] ots = outputTypes.ToArray(); Array.Sort(ots); return(new CommandLineSwitch( "of", "outputFormat", "format", "Mandatory - the type of disk to output, one of " + string.Join(", ", ots, 0, ots.Length - 1) + " or " + ots[ots.Length - 1] + ".")); }