The Queue.Peek() method in C# is used to return the object at the beginning of the Queue 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() { Queue queue = new Queue(); queue.Enqueue("AB"); queue.Enqueue("BC"); queue.Enqueue("CD"); queue.Enqueue("DE"); queue.Enqueue("EF"); queue.Enqueue("FG"); queue.Enqueue("GH"); queue.Enqueue("HI"); Console.WriteLine("Queue..."); IEnumerator demoEnum = queue.GetEnumerator(); ... Read More
The Queue.IsSynchronized() method in C# is used to GET a value indicating whether access to the Queue 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() { Queue queue = new Queue(); queue.Enqueue(100); queue.Enqueue(200); queue.Enqueue(300); queue.Enqueue(400); queue.Enqueue(500); queue.Enqueue(600); queue.Enqueue(700); queue.Enqueue(800); queue.Enqueue(900); queue.Enqueue(1000); ... Read More
The Single.GetHashCode() method in C# is used to return the hash code for this instance.SyntaxThe syntax is as follows −public override int GetHashCode ();ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main() { float f1 = 40.2f; object f2 = 50.5f; Console.WriteLine("Value1 = "+f1); Console.WriteLine("HashCode of Value1 = "+f1.GetHashCode()); Console.WriteLine("Value2 = "+f2); Console.WriteLine("HashCode of Value2 = "+f2.GetHashCode()); Console.WriteLine("Are both the values equal? = "+f1.Equals(f2)); } }OutputThis will produce the ... Read More
The SByte.GetHashCode() method in C# is used to return the hash code for this instance.SyntaxThe syntax is as follows −public override int GetHashCode ();ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main() { sbyte s1 = 50; sbyte s2 = 75; Console.WriteLine("Value of S1 = "+s1); Console.WriteLine("Value of S2 = "+s2); Console.WriteLine("Is s1 and s2 equal? = "+s1.Equals(s2)); Console.WriteLine("HashCode for s1 = "+s1.GetHashCode()); Console.WriteLine("HashCode for s2 = "+s1.GetHashCode()); } ... Read More
The SByte.GetTypeCode() method in C# is used to return the TypeCode for value type SByte.SyntaxThe syntax is as follows −public TypeCode GetTypeCode ();ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main() { sbyte s1 = 55; object s2 = (sbyte)55; Console.WriteLine("Value of S1 = "+s1); Console.WriteLine("Value of S2 = "+s2); int res = s1.CompareTo(s2); if (res > 0) Console.WriteLine("s1 > s2"); else if (res < 0) ... Read More
The BitConverter.ToSingle() method in C# is used to return a single-precision floating point number converted from four bytes at a specified position in a byte array.SyntaxThe syntax is as follows −public static float ToSingle (byte[] value, int begnIndex);Above, val is the byte array, whereas begnIndex is the beginning position within val.ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main() { byte[] arr = {0, 1, 2, 3, 5, 7, 10}; Console.WriteLine("Byte Array = {0} ", BitConverter.ToString(arr)); for (int i ... Read More
The Stack.Pop() method in C# is used to remove and return the object at the top of the Stack.SyntaxThe syntax is as follows −public virtual object Pop ();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
The Single.GetTypeCode() method in C# is used to return the TypeCode for value type Single.SyntaxThe syntax is as follows −public TypeCode GetTypeCode ();ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main() { float f1 = 15.3f; float f2 = 35.9f; Console.WriteLine("Value1 = "+f1); Console.WriteLine("Hashcode for Value1 = "+f1.GetHashCode()); Console.WriteLine("TypeCode for Value1 = "+f1.GetTypeCode()); Console.WriteLine("Value2 = "+f2); Console.WriteLine("Hashcode for Value2 = "+f2.GetHashCode()); Console.WriteLine("TypeCode for Value1 = "+f2.GetTypeCode()); ... Read More
The Int16.ToString() method in C# is used to convert the numeric value of this instance to its equivalent string representation.SyntaxThe syntax is as follows −public override string ToString (); public string ToString (string format);Above, the format parameter is a numeric format string.ExampleLet us now see an example − Live Demousing System; public class Demo { public static void Main() { short val1 = 10; short val2 = 10; Console.WriteLine("Value1 = "+val1.ToString()); Console.WriteLine("Value2 = "+val2.ToString()); Console.WriteLine("HashCode for value1 = "+val1.GetHashCode()); Console.WriteLine("HashCode for value2 ... Read More
The Int32 Struct represents a 32-bit signed integer. It is an immutable value type that represents signed integers with values that range from negative 2, 147, 483, 648 through positive 2, 147, 483, 647.Following are the fields of the Int32 Struct −Sr.NoField & Description1MaxValueRepresents the largest possible value of an Int32. This field is constant.2MinValueRepresents the smallest possible value of an Int32. This field is constant.Following are some of the methods of the Int32 Struct −Sr.NoMethod & Description1CompareTo(Int32)Compares this instance to a specified 32-bit signed integer and returns an integer that indicates whether the value of this instance is less ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP