AmitDiwan has Published 10744 Articles

C# BitConverter.ToUInt16() Method

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 12:03:46

357 Views

The BitConverter.ToUInt16() method in C# is used to return a 16-bit unsigned integer converted from two bytes at a specified position in a byte array.Syntaxpublic static ushort ToUInt16 (byte[] val, int begnIndex);Above, val is the byte array, whereas begnIndex is the beginning position within val.ExampleLet us now see an example ... Read More

TimeSpan.FromSeconds() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 11:57:05

4K+ Views

The TimeSpan.FromSeconds() method in C# is used to return a TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond.SyntaxThe syntax is as follows -public static TimeSpan FromSeconds (double val);Above, the parameter val is the number of seconds, accurate to the nearest millisecond.ExampleLet ... Read More

TimeSpan.FromMinutes() Method in C#

AmitDiwan

AmitDiwan

Updated on 03-Dec-2019 11:51:18

2K+ Views

The TimeSpan.FromMinutes() method in C# is used to return a TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond.Syntaxpublic static TimeSpan FromMinutes (double val);Above, the value val is the number of minutes, accurate to the nearest millisecond.Example Live Demousing System; public class Demo ... Read More

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

611 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

175 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

490 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

172 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

Advertisements