AmitDiwan has Published 10740 Articles

Check if an array contains the elements that match the specified conditions in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 05:44:00

483 Views

To check if an array contains the elements that match the specific conditions, we can use the StartsWith() method in C# −Example Live Demousing System; public class Demo {    public static void Main(){       string[] products = { "Electronics", "Accessories", "Clothing", "Toys", "Clothing", "Furniture" };       ... Read More

Check if a value is in LinkedList in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 05:23:50

126 Views

To check if a value is in LinkedList, try the below code −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(){       LinkedList linkedList = new LinkedList();       linkedList.AddLast(25);       linkedList.AddLast(50);       linkedList.AddLast(100);       linkedList.AddLast(200); ... Read More

Check if a HashSet and a specified collection share common element in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 05:20:15

161 Views

To check if a HashSet and a specified collection share a common element, the C# code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(){       HashSet set1 = new HashSet();       set1.Add(25);       set1.Add(50);   ... Read More

BitConverter Class in C#

AmitDiwan

AmitDiwan

Updated on 04-Dec-2019 05:13:35

1K+ Views

The BitConverter class converts base data types to an array of bytes, and an array of bytes to base data types.Following are the methods −MethodDescriptionDoubleToInt64Bits(Double)Converts the specified double-precision floating-point number to a 64-bit signed integer.GetBytes(Boolean)Returns the specified Boolean value as a byte array.GetBytes(Char)Returns the specified Unicode character value as an ... Read More

Queue.Contains() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 13:19:23

225 Views

The Queue.Contains() method in C# is used to determine whether an element is in the Queue.SyntaxThe syntax is as follows -public virtual bool Contains (object ob);Above, the parameter ob is the Object to locate in the Queue.ExampleLet us now see an example - Live Demousing System; using System.Collections.Generic; public class Demo { ... Read More

StringBuilder.CopyTo() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 13:10:16

338 Views

The StringBuilder.CopyTo() method in C# is used to copy the characters from a specified segment of this instance to a specified segment of a destination Char array.SyntaxThe syntax is as follows -public void CopyTo (int sourceIndex, char[] dest, int destIndex, int count);Above, the parameter sourceIndex is the starting position in ... Read More

Queue.Clone() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 13:06:32

319 Views

The Queue.Clone() method in C# is used to create a shallow copy of the Queue.SyntaxThe syntax is as follows -public virtual object Clone ();ExampleLet us now see an example - Live Demousing System; using System.Collections; public class Demo {    public static void Main(string[] args) {       Queue queue ... Read More

Queue.Clear Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 13:01:58

250 Views

The Queue.Clear() method in C# is used to clear all object from Queue.SyntaxThe syntax is as follows -public virtual void Clear ();ExampleLet us now see an example - Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       Queue queue = new Queue(); ... Read More

Double.IsPositiveInfinity() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 12:57:10

212 Views

The Double.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 (double val);Above, val is a double-precision floating-point number.ExampleLet us now see an example - Live Demousing System; public class Demo {    public ... Read More

StringBuilder.Chars[] Property in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 12:49:09

134 Views

The StringBuilder.Chars[] property gets or sets the character at the specified character position in this instance.SyntaxThe syntax is as follows -public char this[int index] { get; set; }Above, the index parameter is the position of the character.ExampleLet us now see an example - Live Demousing System; using System.Text; public class Demo ... Read More

Advertisements