C# में UInt32.ToString() विधि का उपयोग वर्तमान UInt32 इंस्टेंस के संख्यात्मक मान को इसके समकक्ष स्ट्रिंग प्रतिनिधित्व में बदलने के लिए किया जाता है।
सिंटैक्स
निम्नलिखित वाक्य रचना है -
public override string ToString();
उदाहरण
आइए अब UInt32.ToString() विधि को लागू करने के लिए एक उदाहरण देखें -
using System;
public class Demo {
public static void Main(){
uint val1 = 100;
uint val2 = 80;
Console.WriteLine("Value1 (String representation) = "+val1.ToString());
Console.WriteLine("Value2 (String representation) = "+val2.ToString());
bool res = val1.Equals(val2);
Console.WriteLine("Return value (comparison) = "+res);
if (res)
Console.WriteLine("val1 = val2");
else
Console.WriteLine("val1 != val2");
}
} आउटपुट
यह निम्नलिखित आउटपुट देगा -
Value1 (String representation) = 100 Value2 (String representation) = 80 Return value (comparison) = False val1 != val2
उदाहरण
आइए अब UInt32.ToString() विधि को लागू करने के लिए एक और उदाहरण देखें -
using System;
public class Demo {
public static void Main(){
uint val1 = 0;
uint val2 = UInt32.MaxValue;
Console.WriteLine("Value1 (String representation) = "+val1.ToString());
Console.WriteLine("Value2 (String representation) = "+val2.ToString());
bool res = val1.Equals(val2);
Console.WriteLine("Return value (comparison) = "+res);
if (res)
Console.WriteLine("val1 = val2");
else
Console.WriteLine("val1 != val2");
}
} आउटपुट
यह निम्नलिखित आउटपुट देगा -
Value1 (String representation) = 0 Value2 (String representation) = 4294967295 Return value (comparison) = False val1 != val2