C# function to round double to the place specified.


Following is the simple C# function that provides rounded value based on the inputs.

    /// <summary>
    /// Rounds the specified num.
    /// </summary>
    /// <param name="num">The num.</param>
    /// <param name="place">The place.</param>
    /// <returns></returns>
    public double Round(double num, int place)
    {
      double n;
      n = num * Math.Pow(10, place);
      n = Math.Sign(n) * Math.Abs(Math.Floor(n   .5));
      return n / Math.Pow(10, place);
    }