Found 26504 Articles for Server Side Programming

Double.GetTypeCode() Method in C#

AmitDiwan
Updated on 04-Dec-2019 11:09:39

51 Views

The Double.GetTypeCode() method in C# is used to return the TypeCode for value type Double.SyntaxThe syntax is as follows −public TypeCode GetTypeCode ();ExampleLet us now see an example − Live Demousing System; public class Demo {    public static void Main() {       double d = 15d;       Console.WriteLine("Double Value = "+d);       Console.WriteLine("HashCode of Double Value = "+d.GetHashCode());       TypeCode type = d.GetTypeCode();       Console.WriteLine("TypeCode of Double Value = "+type);    } }OutputThis will produce the following output −Double Value = 15 HashCode of Double Value = 1076756480 TypeCode of Double Value = DoubleExampleLet us now see another example − Live Demousing System; public ... Read More

Single.IsPositiveInfinity() Method in C# with Examples

AmitDiwan
Updated on 04-Dec-2019 11:06:47

140 Views

The Single.IsPositiveInfinity() method in C# is used to return a value indicating whether the specified number evaluates to positive infinity.SyntaxThe syntax is as follows −public static bool IsPositiveInfinity (float val);Above, the parameter val is a single-precision floating-point number.ExampleLet us now see an example − Live Demousing System; public class Demo {    public static void Main() {       float f1 = -25.0f/0.0f;       float f2 = 5.0f/0.0f;       Console.WriteLine("Value1 = "+f1);       Console.WriteLine("Hashcode for Value1 = "+f1.GetHashCode());       Console.WriteLine("TypeCode for Value1 = "+f1.GetTypeCode());       Console.WriteLine("Is Value1 value is positive ... Read More

C# Int16 Struct

AmitDiwan
Updated on 04-Dec-2019 11:02:25

480 Views

The Int16 Struct represents a 16-bit signed integer with values ranging from negative 32768 through positive 32767.Following are the fields of Int16 −Sr.NoField & Description1MaxValue − Represents the largest possible value of an Int16. This field is constant.2MinValue − Represents the smallest possible value of an Int16. This field is constant.Following are some of the methods −Sr.NoMethod & Description1CompareTo(Int16) − Compares this instance to a specified 16-bit signed integer and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified 16-bit signed integer.2CompareTo(Object) − Compares this instance to a specified object and ... Read More

Stack.Peek() Method in C#

AmitDiwan
Updated on 04-Dec-2019 10:46:40

1K+ Views

The Stack.Peek() method in C# is used to return the object at the top of the Stack without removing it.SyntaxThe syntax is as follows −public virtual object Peek ();ExampleLet us now see an example − Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Stack stack = new Stack();       stack.Push("Inspiron");       stack.Push("Alienware");       stack.Push("Projectors");       stack.Push("Monitors");       stack.Push("XPS");       stack.Push("Laptop");       stack.Push("Notebook");       Console.WriteLine("Stack elements...");       foreach(string val in stack) {     ... Read More

Stack.IsSynchronized Property in C#

AmitDiwan
Updated on 04-Dec-2019 10:32:07

96 Views

The Stack.IsSynchronized property in C# is used to get a value indicating whether access to the Stack is synchronized (thread safe).SyntaxThe syntax is as follows −public virtual bool IsSynchronized { get; }ExampleLet us now see an example − Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Stack stack = new Stack();       stack.Push("Inspiron");       stack.Push("Alienware");       stack.Push("Projectors");       stack.Push("Monitors");       stack.Push("XPS");       stack.Push("Laptop");       stack.Push("Notebook");       Console.WriteLine("Stack elements...");       foreach(string val in stack) ... Read More

Double.Equals() Method in C# with Examples

AmitDiwan
Updated on 04-Dec-2019 10:25:44

340 Views

The Double.Equals() method in C# is used to return a value indicating whether two instances of Double represent the same value.SyntaxThe syntax is as follows −public bool Equals (double obj); public override bool Equals (object ob);The obj parameter of the first syntax is a Double object to compare to this instance, whereas the obj of the second parameter is an object to compare with this instance.ExampleLet us now see an example − Live Demousing System; public class Demo {    public static void Main() {       double d1 = 150d;       double d2 = 150d;     ... Read More

Double.CompareTo Method in C# with Examples

AmitDiwan
Updated on 04-Dec-2019 10:21:41

2K+ Views

The Double.CompareTo() method in C# is used to compare this instance to a specified object or Double object and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object or Double object.SyntaxThe syntax is as follows −public int CompareTo (double val); public int CompareTo (object val);Above, the value val in the 1st syntax is a double-precision floating-point number to compare, whereas val for the 2nd syntax is an object to compare.ExampleLet us now see an example − Live Demousing System; public class Demo {    public static void Main() { ... Read More

Boolean.ToString(IFormatProvider) Method in C#

AmitDiwan
Updated on 04-Dec-2019 10:18:07

516 Views

The Boolean.ToString() method in C# is used to convert the value of this instance to its equivalent string representation.SyntaxThe syntax is as follows −public string ToString (IFormatProvider provider);Above, the parameter provider is an IFormatProvider object.ExampleLet us now see an example − Live Demousing System; using System.Globalization; public class Demo {    public static void Main(String[] args) {       bool val1 = true;       bool val2 = false;       Console.WriteLine("Value1 (Hashcode) = "+val1.GetHashCode());       Console.WriteLine("Value1 (TypeCode) = "+val1.GetTypeCode());       Console.WriteLine("Value2 (Hashcode) = "+val2.GetHashCode());       Console.WriteLine("Value2 (TypeCode) = "+val2.GetTypeCode());     ... Read More

Stack.Count Property in C#

AmitDiwan
Updated on 04-Dec-2019 10:12:55

320 Views

The Stack.Count property in C# is used to get the number of elements contained in the Stack.SyntaxThe syntax is as follows −public virtual int Count { get; }ExampleLet us now see an example − Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Stack stack = new Stack();       stack.Push("Inspiron");       stack.Push("Alienware");       stack.Push("Projectors");       stack.Push("Monitors");       stack.Push("XPS");       stack.Push("Laptop");       stack.Push("Notebook");       Console.WriteLine("Stack elements...");       foreach(string val in stack) {       ... Read More

Stack.Contains() Method in C#

AmitDiwan
Updated on 04-Dec-2019 10:07:40

221 Views

The Stack.Contains() method in C# is used to check whether an element is in the Stack or not.SyntaxThe syntax is as follows −public virtual bool Contains (object ob);Above, ob is the object to be searched in the stack.ExampleLet us now see an example − Live Demousing System; using System.Collections; public class Demo {    public static void Main() {       Stack stack = new Stack();       stack.Push("Inspiron");       stack.Push("Alienware");       stack.Push("Projectors");       stack.Push("Monitors");       stack.Push("XPS");       stack.Push("Laptop");       stack.Push("Notebook");       Console.WriteLine("Stack elements...");   ... Read More

Advertisements