title: Should I be using static classes or something other than structs?
body: <p>I needed a way to add filters to a page like so:</p>
  
  <blockquote>
    <p>Catalog/Size-Medium/Color-Red/</p>
  </blockquote>
  
  <p>I have a set amount of filters and they contain properties which are very unlikely to change anytime soon. To process these filters I decided on enums, but this turned very insidious as I needed to incorporate nulls, extension methods, and other properties. </p>
  
  <p>Finally I came across this <a href="https://stackoverflow.com/a/2907408/1347514">Stackoverflow answer</a> which suggested using structs. Here is an example of one I've incorporated:</p>
  
  <pre><code>    public struct Color
  {
      private int id;
      private bool isDef;
  
      private Color(int value) { id = value; isDef = true; }
      public bool Hasvalue { get { return isDef; } }
      public bool IsNull { get { return !isDef; } }
  
      public string Name
      {
          get
          {
              switch(id)
              {
                  case 0: return "None";
                  case 1: return "Black";
                  case 2: return "Blue";
                  case 3: return "Green";
                  case 4: return "Orange";
                  case 5: return "Pink";
                  case 6: return "Brown";
                  case 7: return "White";
                  case 8: return "Yellow";
                  case 9: return "Gray";
                  case 10: return "Purple";
                  case 11: return "Red";
                  default: return null;
              }
          }
      }
  
      public string Abbreviation
      {
          get
          {
              switch(id)
              {
                  case 1: return "BK";
                  case 2: return "BL";
                  case 3: return "GR";
                  case 4: return "OR";
                  case 5: return "PK";
                  case 6: return "BN";
                  case 7: return "WT";
                  case 8: return "YL";
                  case 9: return "GY";
                  case 10: return "PR";
                  case 11: return "RD";
                  default: return null;
              }
          }
      }
  
      public static IEnumerable&lt;Color&gt; GetValues()
      {
          yield return Color.None;
          yield return Color.Black;
          yield return Color.Blue;
          yield return Color.Green;
          yield return Color.Orange;
          yield return Color.Pink;
          yield return Color.Brown;
          yield return Color.White;
          yield return Color.Yellow;
          yield return Color.Gray;
          yield return Color.Purple;
          yield return Color.Red;
      }
  
      public static Color Parse(string value)
      {
          if (String.IsNullOrEmpty(value))
              return Color.None;
          foreach (var c in GetValues())
          {
              if (String.Equals(c.Name, value, StringComparison.Ordinal))
                  return c;
          }
          return Color.None;
      }
  
      public override bool Equals(object obj)
      {
          if(!(obj is Color))
              return false;
          Color color = (Color)obj;
          return color.Name.Equals(this.Name, StringComparison.Ordinal);
      }
  
      public static Color None = new Color(0);
      public static Color Black = new Color(1);
      public static Color Blue = new Color(2);
      public static Color Green = new Color(3);
      public static Color Orange = new Color(4);
      public static Color Pink = new Color(5);
      public static Color Brown = new Color(6);
      public static Color White = new Color(7);
      public static Color Yellow = new Color(8);
      public static Color Gray = new Color(9);
      public static Color Purple = new Color(10);
      public static Color Red = new Color(11);
  }
  </code></pre>
  
  <p>These work well but they just don't feel correct in some way. For example, I'm having to write the same code for each struct, which seems like a lot of code. It would be so much easier to inherit reusable code, and to constrict the data to interfaces somehow.</p>
  
  <p>Is there a better way of doing this? I've tried using Static Classes but couldn't get my head around how to build one with similar functionality to my struct. </p>
  
  <p>Sorry if I seem hopeless at posting, it's my first time.</p>