C# में Int64.GetTypeCode() विधि का उपयोग Int64 के मान प्रकार के लिए TypeCode को वापस करने के लिए किया जाता है।
सिंटैक्स
निम्नलिखित वाक्य रचना है -
public TypeCode GetTypeCode ();
उदाहरण
आइए अब Int64.GetTypeCode() पद्धति को लागू करने के लिए एक उदाहरण देखें -
using System; public class Demo { public static void Main(){ long val1 = 0; long val2 = Int64.MaxValue; Console.WriteLine("Value1 = "+val1); Console.WriteLine("Value2 = "+val2); Console.WriteLine("Are they equal? = "+val1.Equals(val2)); Console.WriteLine("Value1 (HashCode) = "+val1.GetHashCode()); Console.WriteLine("Value2 (HashCode) = "+val2.GetHashCode()); TypeCode type1 = val1.GetTypeCode(); TypeCode type2 = val2.GetTypeCode(); Console.WriteLine("TypeCode for val1 = "+val1.GetTypeCode()); Console.WriteLine("TypeCode for val2 = = "+val1.GetTypeCode()); } }
आउटपुट
यह निम्नलिखित आउटपुट देगा -
Value1 = 0 Value2 = 9223372036854775807 Are they equal? = False Value1 (HashCode) = 0 Value2 (HashCode) = -2147483648 TypeCode for val1 = Int64 TypeCode for val2 = = Int64
उदाहरण
आइए अब Int64.GetTypeCode() पद्धति को लागू करने के लिए एक और उदाहरण देखें -
using System; public class Demo { public static void Main(){ long val1 = 8768768766; long val2 = Int64.MaxValue; Console.WriteLine("Value1 = "+val1); Console.WriteLine("Value2 = "+val2); Console.WriteLine("Are they equal? = "+val1.Equals(val2)); Console.WriteLine("Value1 (HashCode) = "+val1.GetHashCode()); Console.WriteLine("Value2 (HashCode) = "+val2.GetHashCode()); TypeCode type1 = val1.GetTypeCode(); TypeCode type2 = val2.GetTypeCode(); Console.WriteLine("TypeCode for val1 = "+val1.GetTypeCode()); Console.WriteLine("TypeCode for val2 = = "+val1.GetTypeCode()); } }
आउटपुट
यह निम्नलिखित आउटपुट देगा -
Value1 = 8768768766 Value2 = 9223372036854775807 Are they equal? = False Value1 (HashCode) = 178834172 Value2 (HashCode) = -2147483648 TypeCode for val1 = Int64 TypeCode for val2 = = Int64