Found 26504 Articles for Server Side Programming

Single.IsInfinity() Method in C# with Example

AmitDiwan
Updated on 03-Dec-2019 09:23:17

134 Views

The Single.IsInfinity() method in C# is used to return a value indicating whether the specified number evaluates to negative or positive infinity.SyntaxThe syntax is as follows −public static bool IsInfinity (float val);Above, 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 = 19.3f;       float f2 = Single.MaxValue;       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 ... Read More

Int 64 Struct in C#

AmitDiwan
Updated on 03-Dec-2019 09:19:44

2K+ Views

The Int 64 struct represents a 64-bit signed integer. It is an immutable value type representing signed integers with values: negative 9, 223, 372, 036, 854, 775, 808 through positive 9, 223, 372, 036, 854, 775, 807.Following are the fields of Int 64 −FieldDescriptionMaxValueRepresents the largest possible value of an Int64. This field is constant.MinValueRepresents the smallest possible value of an Int64. This field is constant.Following are some of the methods −FieldDescriptionCompareTo(Int64)Compares this instance to a specified 64-bit signed integer and returns an indication of their relative values.CompareTo(Object)Compares this instance to a specified object and returns an indication of their ... Read More

Random.NextDouble() Method in C#

AmitDiwan
Updated on 03-Dec-2019 09:12:56

928 Views

The Random.NextDouble() method in C# is used to return a random floating-point number that is greater than or equal to 0.0, and less than 1.0.SyntaxThe syntax is as follows −public virtual double NextDouble ();ExampleLet us now see an example − Live Demousing System; public class Demo {    public static void Main(){       Random r1 = new Random();       Random r2 = new Random();       Byte[] arr = new Byte[2];       r1.NextBytes(arr);       Console.WriteLine("Random numbers in the byte array...");       for (int i = 0; i < 2; i++) ... Read More

SortedDictionary.Remove() Method in C#

AmitDiwan
Updated on 03-Dec-2019 08:19:23

132 Views

The SortedDictionary.Remove() method in C# is used to remove the element with the specified key from the SortedDictionary.OutputThe syntax is as follows −public bool Remove (TKey key);Above, the parameter key is the key of the element to remove.ExampleLet us now see an example − Live Demousing System; using System.Collections; using System.Collections.Generic; public class Demo {    public static void Main(){       SortedDictionary sortedDict = new SortedDictionary();       sortedDict.Add(100, "Mobile");       sortedDict.Add(200, "Laptop");       sortedDict.Add(300, "Desktop");       sortedDict.Add(400, "Speakers");       sortedDict.Add(500, "Headphone");       sortedDict.Add(600, "Earphone");       ... Read More

SortedDictionary.Keys Property in C#

AmitDiwan
Updated on 03-Dec-2019 08:16:32

271 Views

The SortedDictionary.Keys property in C# is used to get a collection containing the keys in the SortedDictionary.SyntaxThe syntax is as follows −public System.Collections.Generic.SortedDictionary.KeyCollection Keys { get; }ExampleLet us now see an example − Live Demousing System; using System.Collections; using System.Collections.Generic; public class Demo {    public static void Main(){       SortedDictionary sortedDict = new SortedDictionary();       sortedDict.Add(1, "SUV");       sortedDict.Add(2, "MUV");       sortedDict.Add(3, "Utility Vehicle");       sortedDict.Add(4, "AUV");       sortedDict.Add(5, "Hatchback");       sortedDict.Add(6, "Convertible");       Console.WriteLine("SortedDictionary key-value pairs...");       IDictionaryEnumerator demoEnum = sortedDict.GetEnumerator(); ... Read More

SByte.ToString() Method in C# with Examples

AmitDiwan
Updated on 03-Dec-2019 08:12:44

414 Views

The SByte.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 ();ExampleLet us now see an example − Live Demousing System; public class Demo {    public static void Main(){       sbyte s1 = 10;       sbyte s2 = 100;       Console.WriteLine("Value of S1 = "+s1);       Console.WriteLine("Value of S2 = "+s2);       int res = s1.CompareTo(s2);       if (res > 0)          Console.WriteLine("s1 > s2");       ... Read More

BitConverter.ToInt32() Method in C#

AmitDiwan
Updated on 03-Dec-2019 08:08:52

429 Views

The BitConverter.ToInt32() method in C# is used to return a 32-bit signed integer converted from four bytes at a specified position in a byte array.SyntaxThe syntax is as follows −public static int ToInt32 (byte[] val, 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 = { 10, 20, 30, 40, 50};       Console.WriteLine("Byte Array = {0} ", BitConverter.ToString(arr));       for (int i = 1; i < arr.Length - ... Read More

Single.CompareTo() Method in C# with Examples

AmitDiwan
Updated on 03-Dec-2019 08:04:19

219 Views

The Single.CompareTo() method in C# is used to compare this instance to a specified object or to another Single instance and returns an integer that indicates whether the value of this instance is less than, equal to, or greater than the value of the specified object or the other Single instance.The return value is less than zero if the 1st instance is less than 2nd. The return value is 0 if both are equal and greater than zero is 0, if the 1st instance is more than 2nd.SynchronizedThe syntaxes are as follows −public int CompareTo (float val); public int CompareTo ... Read More

BitConverter.ToDouble() Method in C#

AmitDiwan
Updated on 03-Dec-2019 08:00:36

223 Views

The BitConverter.ToDouble() method in C# is used to return a double-precision floating-point number converted from eight bytes at a specified position in a byte array.SynchronizedThe syntax is as follows −public static double ToDouble (byte[] val, 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, 2, 5, 10, 20, 26, 34, 42, 50, 58, 66, 74, 82, 89, 97, 107, 115};       Console.WriteLine("Byte Array = {0} ", BitConverter.ToString(arr)); ... Read More

BitConverter.ToInt16() Method in C#

AmitDiwan
Updated on 03-Dec-2019 07:58:14

268 Views

The BitConverter.ToInt16() method in C# is used to return a 16-bit signed integer converted from two bytes at a specified position in a byte array.SyntaxThe syntax is as follows −public static short ToInt16 (byte[] val, 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, 0, 7, 10, 18, 20, 25, 26, 32};       Console.WriteLine("Byte Array = {0} ", BitConverter.ToString(arr));       for (int i = 1; ... Read More

Advertisements