Perhaps this pseudo-enumeration pattern will be useful:
public class OutputFormats { public readonly string Value; public readonly string Filename; public readonly int ID; private OutputFormats(string value, string filename, int id) { this.Value = value; this.Filename = filename; this.ID = id; } public static readonly OutputFormats Pdf = new OutputFormats("Pdf", "*.PDF", 1); public static readonly OutputFormats Jpg = new OutputFormats("Jpg", "*.JPG", 2); }
Another option, perhaps more concise:
public class OutputFormats { public string Value { get; private set; } public string Filename { get; private set; } public int ID { get; private set; } private OutputFormats() { } public static readonly OutputFormats Pdf = new OutputFormats() { Value = "Pdf", Filename = "*.PDF", ID = 1 }; public static readonly OutputFormats Jpg = new OutputFormats() { Value = "Jpg", Filename = "*.JPG", ID = 2 }; }
source share