C# এ টাইপকোড পেতে, কোডটি নিম্নরূপ -
উদাহরণ
using System; public class Demo { public static void Main(){ string s = "Demo"; Console.WriteLine("String = " +s); Console.WriteLine("String Type = " +s.GetType()); Console.WriteLine("GetTypeCode = " +s.GetTypeCode()); } }
আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবেString = Demo String Type = System.String GetTypeCode = String
উদাহরণ
এখন আরেকটি উদাহরণ দেখা যাক -
using System; public class Demo { public static void Main(){ int i = 100; double d = 5.26d; Console.WriteLine("Value1 = " +i); Console.WriteLine("GetType = " +i.GetType()); Console.WriteLine("GetTypeCode = " +i.GetTypeCode()); Console.WriteLine("\nValue2 = " +d); Console.WriteLine("GetType = " +d.GetType()); Console.WriteLine("GetTypeCode = " +d.GetTypeCode()); } }
আউটপুট
এটি নিম্নলিখিত আউটপুট −
তৈরি করবেValue1 = 100 GetType = System.Int32 GetTypeCode = Int32 Value2 = 5.26 GetType = System.Double GetTypeCode = Double