AmitDiwan has Published 10740 Articles

C# String.Contains() Method

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 11:38:59

8K+ Views

The String.Contains() method in C# is used to return a value indicating whether a specified substring occurs within this string.Syntaxpublic bool Contains (string val);Above, val is the string to search for.Example Live Demousing System; public class Demo {    public static void Main(String[] args) {       string str1 = ... Read More

C# Stack.TrimExcess() Method with Examples

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 10:35:34

662 Views

The Stack.TrimExcess() method in C# is used to set the capacity to the actual number of elements in the List, if that number is less than a threshold value.Syntaxpublic void TrimExcess ();Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       Stack ... Read More

Array.BinarySearch(Array, Object) Method with examples in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 10:27:25

201 Views

The Array.BinarySearch(Array, Object) method in C# is used to search an entire one-dimensional sorted array for a specific element, using the IComparable interface implemented by each element of the array and by the specified object.Syntaxpublic static int BinarySearch (Array arr, object val);Above, arr is the sorted 1-D array, whereas val ... Read More

C# Copy() Method

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 10:19:27

508 Views

The Copy() method in C# is used to create a new instance of String with the same value as a specified String.Syntaxpublic static string Copy (string s);Above, s is the string to copy.Example Live Demousing System; public class Demo {    public static void Main(string[] args) {       string ... Read More

StringBuilder.ToString() Method in C#

AmitDiwan

AmitDiwan

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

2K+ Views

The StringBuilder.ToString() method in C# is used to convert the value of a StringBuilder to a String.SyntaxThe syntax is as follows −public override string ToString (); public string ToString (int begnIndex, int len);Above, the parameter begnIndex is the starting position of the substring in this instance, whereas len is the ... Read More

Random.Next() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 09:54:27

3K+ Views

The Random.Next() method in C# is used to return a non-negative random integer.SyntaxThe syntax is as follows −public virtual int Next (); public virtual int Next (int maxVal);Above, the maxVal parameter is the exclusive upper bound of the random number to be generated.ExampleLet us now see an example − Live Demousing ... Read More

SortedDictionary.Values Property in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 09:52:19

213 Views

The SortedDictionary.Value property in C# is used to get a collection containing the values in the SortedDictionary.SyntaxThe syntax is as follows −public System.Collections.Generic.SortedDictionary.ValueCollection Values { get; }ExampleLet us now see an example − Live Demousing System; using System.Collections; using System.Collections.Generic; public class Demo {    public static void Main(){     ... Read More

Double.IsNegativeInfinity() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 09:48:11

81 Views

The Double.IsNegativeInfinity() method in C# is used to return a value indicating whether the specified number evaluates to negative infinity.SyntaxThe syntax is as follows −public static bool IsNegativeInfinity (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

Boolean.GetTypeCode() Method in C# with Examples

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 09:46:18

98 Views

The Boolean.GetTypeCode() method in C# is used to return the type code for the Boolean value type.SyntaxThe syntax is as follows −public TypeCode GetTypeCode ();ExampleLet us now see an example − Live Demousing System; public class Demo {    public static void Main(String[] args){       string str = "JackSparrow!"; ... Read More

StringBuilder.EnsureCapacity() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 09:43:35

175 Views

The StringBuilder.EnsureCapacity() method in C# is used to ensure that the capacity of this instance of StringBuilder is at least the specified value.SyntaxThe syntax is as follows −public int EnsureCapacity (int capacity);Above, the parameter capacity is the minimum capacity to ensure.ExampleLet us now see an example − Live Demousing System; using ... Read More

Advertisements