उदाहरण 1: अमान्य स्ट्रिंग पार्स करना
using System;
public class Demo {
public static void Main() {
bool res;
Char ch;
res = Char.TryParse("10", out ch);
Console.WriteLine(res);
Console.WriteLine(ch.ToString());
}
}
आउटपुट
False
उदाहरण 2: वैध वर्ण पार्स करना
using System;
public class Demo {
public static void Main() {
bool res;
Char ch;
res = Char.TryParse("P", out ch);
Console.WriteLine(res);
Console.WriteLine(ch.ToString());
}
}
आउटपुट
True P