Int64 GetHashCode Method in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 05:54:55

163 Views

The Int64.GetHashCode() method in C# is used to return the hash code for this instance.SyntaxFollowing is the syntax −public override int GetHashCode ();ExampleLet us now see an example to implement the Int64.GetHashCode() method −using System; public class Demo {    public static void Main(){       long val1 = 8768768768;       long val2 = 7889765555;       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());    } }OutputThis will produce the following output ... Read More

Int64 Equals Method in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 05:52:48

157 Views

The Int64.Equals() method in C# is used to return a value indicating whether this instance is equal to a specified object or Int64.SyntaxFollowing is the syntax −public bool Equals (long ob); public override bool Equals (object ob);Above, the parameter ob is an Int64 value to compare to this instance, whereas the parameter ob is an object to compare with this instance.ExampleLet us now see an example to implement the Int64.Equals() method −using System; public class Demo {    public static void Main(){       long val1 = 150;       long val2 = 240;       Console.WriteLine("Value1 ... Read More

Int64 CompareTo Method in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 05:50:43

235 Views

The Int64.CompareTo() method in C# is used to compare this instance to a specified object or Int64 and returns an indication of their relative values.SyntaxFollowing is the syntax −public int CompareTo (long val); public int CompareTo (object val);Above, in the 1st syntax, the value Val is an integer to compare. The Val in the 2nd syntax is an object to compare.ExampleLet us now see an example to implement the Int64.CompareTo() method −using System; public class Demo {    public static void Main(){       long val1 = 20;       long val2 = 18;       Console.WriteLine("Value ... Read More

Int32.MinValue Field in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 05:48:40

393 Views

The Int32.MaxValue field in C# is used to represent the smallest possible value of an Int32.SyntaxFollowing is the syntax −public const int MinValue = -2147483648;ExampleLet us now see an example to implement the Int32.MinValue field &miuns;sing System; public class Demo {    public static void Main(){       int val1 = 23;       int val2 = 0;       Console.WriteLine("Value1 = "+val1);       Console.WriteLine("Value2 = "+val2);       Console.WriteLine("HashCode for value1 = "+val1.GetHashCode());       Console.WriteLine("HashCode for value2 = "+val2.GetHashCode());       Console.WriteLine("Are they equal? = "+(val1.Equals(val2)));       TypeCode ... Read More

Uint32 MinValue Field in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 05:48:39

206 Views

The UInt32.MinValue field in C# represents the minimum value of the 32-bit unsigned integer.SyntaxFollowing is the syntax −public const uint MinValue = 0;ExampleLet us now see an example to implement the UInt32.MinValue field −using System; public class Demo {    public static void Main(){       uint val1 = 23;       uint val2 = 0;       Console.WriteLine("Value1 = "+val1);       Console.WriteLine("Value2 = "+val2);       Console.WriteLine("HashCode for value1 = "+val1.GetHashCode());       Console.WriteLine("HashCode for value2 = "+val2.GetHashCode());       Console.WriteLine("Are they equal? = "+(val1.Equals(val2)));       TypeCode type1 = ... Read More

Uint32 MaxValue Field in Chash with Examples

AmitDiwan
Updated on 13-Nov-2019 05:47:09

315 Views

The UInt32.MaxValue field in C# represents the maximum value of the 32-bit unsigned integer.SyntaxFollowing is the syntax −public const uint MaxValue = 4294967295;ExampleLet us now see an example to implement the UInt32.MaxValue field −using System; public class Demo {    public static void Main(){       uint val1 = 23;       uint val2 = 0;       Console.WriteLine("Value1 = "+val1);       Console.WriteLine("Value2 = "+val2);       Console.WriteLine("HashCode for value1 = "+val1.GetHashCode());       Console.WriteLine("HashCode for value2 = "+val2.GetHashCode());       Console.WriteLine("Are they equal? = "+(val1.Equals(val2)));       TypeCode type1 = ... Read More

Int32.MaxValue Field in C# with Examples

AmitDiwan
Updated on 13-Nov-2019 05:46:35

591 Views

The Int32.MaxValue field in C# is used to represent the largest possible value of an Int32.SyntaxFollowing is the syntax −public const int MaxValue = 2147483647;ExampleLet us now see an example to implement the Int32.MaxValue field −using System; public class Demo {    public static void Main(){       int val1 = 23;       int val2 = 23;       Console.WriteLine("Value1 = "+val1);       Console.WriteLine("Value2 = "+val2);       Console.WriteLine("HashCode for value1 = "+val1.GetHashCode());       Console.WriteLine("HashCode for value2 = "+val2.GetHashCode());       Console.WriteLine("Are they equal? = "+(val1.Equals(val2)));       TypeCode ... Read More

URI Equals Object Method in C#

AmitDiwan
Updated on 13-Nov-2019 05:45:18

115 Views

The Uri.Equals() method in C# compares two Uri instances for equality.SyntaxFollowing is the syntax −public override bool Equals (object comparand);Above, the parameter comparand is the Uri instance or a URI identifier to compare with the current instance.ExampleLet us now see an example to implement the Uri.Equals() method −using System; public class Demo {    public static void Main(){       Uri newURI1 = new Uri("https://www.tutorialspoint.com/index.htm");       Console.WriteLine("URI = "+newURI1);       Uri newURI2 = new Uri("https://www.tutorialspoint.com/index.htm");       Console.WriteLine("URI = "+newURI2);       if(newURI1.Equals(newURI2))          Console.WriteLine("Both the URIs are equal!");   ... Read More

URI CheckSchemeName String Method in C#

AmitDiwan
Updated on 13-Nov-2019 05:42:50

160 Views

The Uri.CheckSchemeName() method in C# is used to determine whether the specified scheme name is valid.syntaxFollowing is the syntax −public static bool CheckSchemeName (string schemeName);Above, the parameter scheme name is the scheme name to validate.ExampleLet us now see an example to implement the Uri.CheckSchemeName() method −using System; public class Demo {    public static void Main(){       Uri newURI = new Uri("https://www.tutorialspoint.com");       Console.WriteLine("URI = "+newURI);       string schemeName = newURI.Scheme;       if(Uri.CheckSchemeName(schemeName))          Console.WriteLine("Valid: Scheme name");       else          Console.WriteLine("Invalid: Scheme name");   ... Read More

Check Hostname Using String Method in C#

AmitDiwan
Updated on 13-Nov-2019 05:40:50

393 Views

The Uri.CheckHostName() method in C# is used to determine whether the specified hostname is a valid DNS name.SyntaxFollowing is the syntax −public static UriHostNameType CheckHostName (string host_name);ExampleLet us now see an example to implement the Uri.CheckHostName() method −using System; public class Demo {    public static void Main(){       string strURI = "http://localhost";       Console.WriteLine("URI = "+strURI);       UriHostNameType res = Uri.CheckHostName(strURI);       Console.WriteLine("Host type = "+res);    } }OutputThis will produce the following output −URI = http://localhost Host type = UnknownExampleLet us now see another example to implement the Uri.CheckHostName() method ... Read More

Advertisements