[TestMethod] public void TestMethod1() { decimal a = 10; decimal b = 10.0m; decimal c = .0m; decimal d = 0.0m; decimal e = 0m; decimal f = 0.00001000m; var a1 = Format(a); var b1 = Format(b); var c1 = Format(c); var d1 = Format(d); var e1 = Format(e); var f1 = Format(f); Assert.AreEqual("10", a1); Assert.AreEqual("10", b1); Assert.AreEqual("0", c1); Assert.AreEqual("0", d1); Assert.AreEqual("0", e1); Assert.AreEqual("0.00001", f1); } public string Format(decimal a) { return a.ToString("0.#########"); }