Found 26504 Articles for Server Side Programming

C# BitConverter.ToInt64() Method

AmitDiwan
Updated on 04-Dec-2019 13:02:28

277 Views

The BitConverter.ToInt64() method in C# is used to return a 64-bit signed integer converted from eight bytes at a specified position in a byte array.SyntaxThe syntax is as follows −public static long ToInt64 (byte[] val, int begnIndex);Above, val is the byte array, whereas begnIndex is the beginning position within val.Let us now see an example −Example Live Demousing System; public class Demo {    public static void Main() {       byte[] arr = { 0, 10, 15, 20, 26, 30, 34, 42, 50};       Console.WriteLine("Byte Array = {0} ", BitConverter.ToString(arr));       for (int i = ... Read More

SByte.Equals() Method in C# with Examples

AmitDiwan
Updated on 04-Dec-2019 12:57:16

75 Views

The SByte.Equals() method in C# is used to return a value indicating whether this instance is equal to a specified object or SByte.SyntaxThe syntax is as follows −public bool Equals (sbyte ob); public override bool Equals (object ob);Above, the ob parameter for an SByte value to compare to this instance, whereas the ob parameter for the 2nd syntax is an object to compare with this instance.ExampleLet us now see an example − Live Demousing System; public class Demo {    public static void Main() {       sbyte s1 = 10;       sbyte s2 = 100;     ... Read More

Stack.Push() Method in C#

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

729 Views

The Stack.Push() method in C# is used to insert an object at the top of the Stack.SyntaxThe syntax is as follows −public virtual void Push (object ob);Above, the parameter ob is the object to push onto 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(150);       stack.Push(300);       stack.Push(500);       stack.Push(750);       stack.Push(1000);       stack.Push(1250);       stack.Push(1500);       stack.Push(2000);     ... Read More

Single.IsNegativeInfinity() Method in C# with Examples

AmitDiwan
Updated on 04-Dec-2019 12:49:35

92 Views

The Single.IsNegative() method in C# returns a value indicating whether the specified number evaluates to negative infinity.SyntaxThe syntax is as follows −public static bool IsNegativeInfinity (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 = 5.0f/0.0f;       float f2 = 0.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 or negative infinity? ... Read More

SByte.CompareTo() Method in C# with Examples

AmitDiwan
Updated on 04-Dec-2019 12:46:08

79 Views

The SByte.CompareTo() method in C# is used to compare this instance to a specified object or SByte and returns an indication of their relative values.SyntaxThe syntax is as follows −public int CompareTo (sbyte val); public int CompareTo (object ob);Above, the parameter val is an 8-bit signed integer to compare, whereas ob 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() {       sbyte s1 = 55;       sbyte s2 = 55;       Console.WriteLine("Value of S1 = "+s1); ... Read More

Stack.ToString() Method in C# with examples

AmitDiwan
Updated on 04-Dec-2019 12:43:14

1K+ Views

The Stack.ToString() method in C# is used to get the string representation of the Stack class object.SyntaxThe syntax is as follows −public string ToString ();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(150);       stack.Push(300);       stack.Push(500);       stack.Push(750);       stack.Push(1000);       stack.Push(1250);       stack.Push(1500);       stack.Push(2000);       stack.Push(2500);       Console.WriteLine("Stack elements...");       foreach(int val in ... Read More

Stack.ToArray() Method in C#

AmitDiwan
Updated on 04-Dec-2019 12:38:36

301 Views

The Stack.ToArray() method in C# is used to copy the Stack to a new array.SyntaxThe syntax is as follows −public virtual object[] ToArray ();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) {          Console.WriteLine(val);     ... Read More

Stack.Synchronized() Method in C#

AmitDiwan
Updated on 04-Dec-2019 12:33:33

105 Views

The Stack.Synchronized() method in C# is used to returns a synchronized (thread safe) wrapper for the Stack.SyntaxThe syntax is as follows −public static System.Collections.Stack Synchronized (System.Collections.Stack stack);Above, the parameter stack is the stack to synchronize.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(150);       stack.Push(300);       stack.Push(500);       stack.Push(750);       stack.Push(1000);       stack.Push(1250);       stack.Push(1500);       stack.Push(2000);       stack.Push(2500);   ... Read More

Single.IsNaN() Method in C# with Examples

AmitDiwan
Updated on 04-Dec-2019 12:28:12

181 Views

The Single.IsNan() method in C# is used to return a value that indicates whether the specified value is not a number (NaN).SyntaxThe syntax is as follows −public static bool IsNaN (float f);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 = 5.0f/0.0f;       float f2 = 45.5f;       Console.WriteLine("Value1 = "+f1);       Console.WriteLine("Hashcode for Value1 = "+f1.GetHashCode());       Console.WriteLine("TypeCode for Value1 = "+f1.GetTypeCode());       Console.WriteLine("Is Value1 value ... Read More

Stack.Clear() Method in C#

AmitDiwan
Updated on 04-Dec-2019 12:24:23

256 Views

The Stack.Clear() method in C# is used to removes all objects from the Stack.SyntaxThe syntax is as follows −public virtual void Clear ();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) {          Console.WriteLine(val);       ... Read More

Advertisements