title: Switch with Object Instances
body: <h3>Edit</h3>
  <p>Here is a different version of the code that makes it a little more clear about what I am trying to do:</p>
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          RepairCar(Car.Ferrari);
      }
  
      public static void RepairCar(Car BrokenCar)
      {
          switch (BrokenCar)
          {
              case Car.Ferrari:
                  Console.WriteLine(&quot;${0} of Insurance Needed&quot;, CalculateInsurance(BrokenCar));
                  // 
                  // Repair Algorithm Here
                  //
                  break;
  
              case Car.BMW:
                  Console.WriteLine(&quot;${0} of Insurance Needed&quot;, CalculateInsurance(BrokenCar));
                  // 
                  // Repair Algorithm Here
                  //
                  break;
  
              case Car.Audi:
                  Console.WriteLine(&quot;${0} of Insurance Needed&quot;, CalculateInsurance(BrokenCar));
                  // 
                  // Repair Algorithm Here
                  //
                  break;
  
              default:
                  Console.WriteLine(&quot;${0} of Insurance Needed&quot;, CalculateInsurance(BrokenCar));
                  // 
                  // Repair Algorithm Here
                  //
                  break;
          }
      }
  
      public static double CalculateInsurance(Car BrokenCar)
      {
          return (BrokenCar.Price / 10);
      }
  
  }
  
  public class Car
  {
      public double Price;
      public int MaxSpeed;
      public int MinSpeed;
  
      public Car(double Price, int MaxSpeed, int MinSpeed)
      {
          this.Price = Price;
          this.MaxSpeed = MaxSpeed;
          this.MinSpeed = MinSpeed;
      }
  
      public static Car Ferrari = new Car(100000, 250, 10);
      public static Car Audi = new Car(50000, 120, 30);
      public static Car BMW = new Car(35000, 80, 75);
  }
  </code></pre>
  <p>As written, this won't compile because it will not let me switch the BrokenCar in the RepairCar method.  Any suggestions?</p>
  <h3>Original Post</h3>
  <p>I am trying to create an object that can store static properties and, more importantly be able to be switched over - here is an example -</p>
  <pre><code>class Program
  {
      static void Main(string[] args)
      {
          Console.WriteLine(GetMaxSpeed(Car.Ferrari));
          Console.ReadLine();
      }
  
      public static int GetMaxSpeed(Car ModelType)
      {
          switch (ModelType)
          {
              case Car.Ferrari:
                  return Car.Ferrari.MaxSpeed;
  
              case Car.VW:
                  return Car.VW.MaxSpeed;
  
              case Car.AstonMartin:
                  return Car.AstonMartin.MaxSpeed;
          }
      }
  
      public class Car
      {
          public int MinSpeed;
          public int MaxSpeed;
  
          public Car(int MinSpeed, int MaxSpeed)
          {
              this.MinSpeed = MinSpeed;
              this.MaxSpeed = MaxSpeed;
          }
  
          public static Car Ferrari = new Car(30, 240);
          public static Car VW = new Car(10, 50);
          public static Car AstonMartin = new Car(75, 180);
      }
  
  }
  </code></pre>
  <p>Does anyone have any ideas?</p>
  <h3>EDIT</h3>
  <p>This example describes a larger, more complex system. To illustrate why I would need to do it this way, see the following update:</p>
  <pre><code>    public static void OnCarSale(Car CarSold)
      {
          double LuxuryTax = 75;
  
          switch (CarSold)
          {
              case Car.Ferrari:
                  Console.WriteLine(&quot;Total Price: {0}&quot;, Car.Ferrari.Price + LuxuryTax);
                  break;
  
              case Car.VW:
                  Console.WriteLine(&quot;Total Price: {0}&quot;, Car.VW);
                  break;
  
              case Car.AstonMartin:
                  Console.WriteLine(&quot;Total Price: {0}&quot;, Car.Ferrari.Price + LuxuryTax);
                  break;
          }
      }
  </code></pre>
  <p>This would get called by an event outside of this class.</p>