C# में Decimal.ToString () विधि का उपयोग इस उदाहरण के संख्यात्मक मान को इसके समकक्ष स्ट्रिंग प्रतिनिधित्व में बदलने के लिए किया जाता है।
सिंटैक्स
निम्नलिखित वाक्य रचना है -
public override string ToString ();
उदाहरण
आइए अब Decimal.ToString() विधि को लागू करने के लिए एक उदाहरण देखें -
using System;
public class Demo{
public static void Main(){
decimal d = 3444.787m;
string str = d.ToString();
Console.WriteLine("String = "+str);
}
} आउटपुट
यह निम्नलिखित आउटपुट देगा -
String = 3444.787
उदाहरण
आइए एक और उदाहरण देखें -
using System;
public class Demo{
public static void Main(){
decimal d = 100;
string str = d.ToString();
Console.WriteLine("String = "+str);
}
} आउटपुट
यह निम्नलिखित आउटपुट देगा -
String = 100