Server Side Programming Articles - Page 2105 of 2650

UInt32.MinValue Field in C# with Examples

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

205 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 C# with Examples

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

313 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

UInt32.GetTypeCode() Method in C# with Examples

AmitDiwan
Updated on 08-Nov-2019 06:54:17

113 Views

The UInt32.GetTypeCode() method in C# is used to return the TypeCode for value type UInt32.SyntaxFollowing is the syntax −public TypeCode GetTypeCode ();ExampleLet us now see an example to implement the UInt32.GetTypeCode() method −using System; public class Demo {    public static void Main(){       uint val1 = 55;       uint val2 = 100;       TypeCode type1 = val1.GetTypeCode();       TypeCode type2 = val2.GetTypeCode();       Console.WriteLine("Typecode for val1 = "+type1);       Console.WriteLine("Typecode for val2 = "+type2);    } }OutputThis will produce the following output −Typecode for val1 = UInt32 ... Read More

Math Class Fields with Examples in C#

AmitDiwan
Updated on 08-Nov-2019 06:52:17

147 Views

The Math class in C# has Math.E and Math.PI fields. Let us see an example of both the fields −Math.ESyntaxIt is the natural logarithmic base specified by the constant e. The syntax is as follows −public const double E = 2.71828182845905;ExampleLet us now see an example −using System; public class Demo{    public static void Main(){       double d = Math.E;       Console.WriteLine("Math.E = " + d);    } }OutputThis will produce the following output −Math.E = 2.71828182845905Math.PIThe Math.PI field represents the ratio of the circumference of a circle to its diameter, specified by the constant, ... Read More

Decimal.ToString() Method in C#

AmitDiwan
Updated on 08-Nov-2019 06:47:29

246 Views

The Decimal.ToString() method in C# is used to convert the numeric value of this instance to its equivalent string representation.SyntaxFollowing is the syntax −public override string ToString ();ExampleLet us now see an example to implement the Decimal.ToString() method −using System; public class Demo{    public static void Main(){       decimal d = 3444.787m;       string str = d.ToString();       Console.WriteLine("String = "+str);    } }OutputThis will produce the following output −String = 3444.787ExampleLet us see another example −using System; public class Demo{    public static void Main(){       decimal d = 100;       string str = d.ToString();       Console.WriteLine("String = "+str);    } }OutputThis will produce the following output −String = 100

Double.ToString Method in C#

AmitDiwan
Updated on 07-Nov-2019 07:31:15

198 Views

The Double.ToString() method in C# is used to convert the numeric value of this instance to its equivalent string representation.SyntaxFollowing is the syntax −public override string ToString ();ExampleLet us now see an example to implement the Double.ToString() method −using System; public class Demo{    public static void Main(){       double d = 45.7878d;       string str = d.ToString();       Console.WriteLine("String = "+str);    } }OutputThis will produce the following output −String = 45.7878ExampleLet us now see another example −using System; public class Demo{    public static void Main(){       double d = ... Read More

Console.Clear Method in C#

AmitDiwan
Updated on 07-Nov-2019 07:27:24

197 Views

The Console.Clear method in C# is used to clear the console buffer and corresponding console window of display information.SyntaxFollowing is the syntax −public static void Clear ();ExampleLet us now see an example before implementing the Console.Clear method −using System; public class Demo {    public static void Main(){       Uri newURI1 = new Uri("https://www.tutorialspoint.com/");       Console.WriteLine("URI = "+newURI1);       Console.WriteLine("String representation = "+newURI1.ToString());       Uri newURI2 = new Uri("https://www.tutorialspoint.com/jquery.htm#abcd");       Console.WriteLine("URI = "+newURI2);       Console.WriteLine("String representation = "+newURI2.ToString());       if(newURI1.Equals(newURI2))          Console.WriteLine("Both the ... Read More

Uri.ToString() Method in C#

AmitDiwan
Updated on 07-Nov-2019 07:24:49

213 Views

The Uri.ToString() method in C# is used to get a canonical string representation for the specified Uri instance.SyntaxFollowing is the syntax −public override string ToString ();ExampleLet us now see an example to implement the Uri.ToString() method −using System; public class Demo {    public static void Main(){       Uri newURI1 = new Uri("https://www.tutorialspoint.com/");       Console.WriteLine("URI = "+newURI1);       Console.WriteLine("String representation = "+newURI1.ToString());       Uri newURI2 = new Uri("https://www.tutorialspoint.com/jquery.htm#abcd");       Console.WriteLine("URI = "+newURI2);       Console.WriteLine("String representation = "+newURI2.ToString());       if(newURI1.Equals(newURI2))          Console.WriteLine("Both the URIs ... Read More

Uri.MakeRelativeUri(Uri) Method in C#

AmitDiwan
Updated on 07-Nov-2019 07:22:50

198 Views

The Uri.MakeRelativeUri(Uri) method in C# is used to determine the difference between two Uri instances.SyntaxFollowing is the syntax −public Uri MakeRelativeUri (Uri uri);Above, the URI is the URI to compare to the current URI.ExampleLet us now see an example to implement the Uri.MakeRelativeUri(Uri) method −using System; public class Demo {    public static void Main(){       Uri newURI1 = new Uri("https://www.tutorialspoint.com/");       Console.WriteLine("URI = "+newURI1);       Uri newURI2 = new Uri("https://www.tutorialspoint.com/java.htm");       Console.WriteLine("URI = "+newURI2);       if(newURI1.Equals(newURI2))          Console.WriteLine("Both the URIs are equal!");       else ... Read More

DateTime.FromFileTimeUtc() Method in C#

AmitDiwan
Updated on 07-Nov-2019 07:20:43

195 Views

The DateTime.FromFileTimeUtc() method in C# converts the specified Windows file time to an equivalent UTC time.SyntaxFollowing is the syntax −public static DateTime FromFileTimeUtc (long time);Here, the parameter time is the Windows file time expressed in ticks (expressed in 100-nanosecond ticks.)ExampleLet us now see an example to implement the DateTime.FromFileTimeUtc() method −using System; public class Demo {    public static void Main() {       DateTime d1 = DateTime.FromFileTimeUtc(6500000000000);       System.Console.WriteLine("DateTime = {0:dd} {0:y}, {0:hh}:{0:mm}:{0:ss} ", d1);    } }OutputThis will produce the following output −DateTime = 08 January 1601, 12:33:20ExampleLet us now see another example to implement ... Read More

Advertisements