title: Combining methods that are the same but take in different variables
body: <p>I have a method I use to take in a number and return the number in a notation format. I'm using doubles, floats, and ints in my code so I have three of the same methods written with only the intake variable different for them. Is there a way I can get the same effect with only 1 method?</p>
  
  <p>To try and explain further. I want to create a method that accepts multiple variable types to it. Instead of the method calling for a double, I'd like it to accept a variable if it's an int, a float, or a double without casting. Right now I have 3 copies of the same method, each one accepting a different variable. I don't want to change all the variables I'm using to doubles for other reasons within the code. </p>
  
  <p>Is there any way I can use one method that accepts all three variable types instead of having 3, each one accepting only one variable type.</p>
  
  <pre><code>public string NotationMethod(double x, string y)
  {
      if (x &gt; 1000)
      {
          var exponent = Math.Floor(Math.Log10(Math.Abs(x)));
          var mantissa = x / Math.Pow(10, exponent);
          return mantissa.ToString("F2") + "e" + exponent;
      }
      return x.ToString("F0");
  }
  
  public string NotationMethod(int x, string y)
  {
      if (x &gt; 1000)
      {
          var exponent = Math.Floor(Math.Log10(Math.Abs(x)));
          var mantissa = x / Math.Pow(10, exponent);
          return mantissa.ToString("F2") + "e" + exponent;
      }
      return x.ToString("F0");
  }
  
  public string NotationMethod(float x, string y)
  {
      if (x &gt; 1000)
      {
          var exponent = Math.Floor(Math.Log10(Math.Abs(x)));
          var mantissa = x / Math.Pow(10, exponent);
          return mantissa.ToString("F2") + "e" + exponent;
      }
      return x.ToString("F0");
  }
  </code></pre>