title: Using Switch case with Equals method in C#
body: <p>Is there a way to convert the below if else condition into Switch in C#. I am using Equals method for checking the type, but unable to convert to switch case.</p>
  
  <pre><code>if (fi.FieldType.Equals(typeof(int)))
  {
      fi.SetValue(data, BitConverter.ToInt32(buffer, 0));
  }
  else if (fi.FieldType.Equals(typeof(bool)))
  {
      fi.SetValue(data, BitConverter.ToBoolean(buffer, 0));
  }
  else if (fi.FieldType.Equals(typeof(string)))
  {
      byte[] tmp = new byte[la.length];
      Array.Copy(buffer, tmp, tmp.Length);
      fi.SetValue(data, System.Text.Encoding.UTF8.GetString(tmp));
  }
  else if (fi.FieldType.Equals(typeof(double)))
  {
      fi.SetValue(data, BitConverter.ToDouble(buffer, 0));
  }
  else if (fi.FieldType.Equals(typeof(short)))
  {
      fi.SetValue(data, BitConverter.ToInt16(buffer, 0));
  }
  </code></pre>
  
  <p>Please help us....</p>