Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by AmitDiwan
Page 230 of 840
Convert.ToSByte(String, IFormatProvider) Method in C#
The Convert.ToSByte(String, IFormatProvider) method in C# converts the specified string representation of a number to an equivalent 8-bit signed integer, using the specified culture-specific formatting information. This method is particularly useful when working with numeric strings that may have different formatting conventions based on locale. Syntax Following is the syntax − public static sbyte ToSByte(string value, IFormatProvider provider); Parameters value − A string that contains the number to convert. The value must be between -128 and 127. provider − An object that supplies culture-specific formatting information. This can be ...
Read MoreDictionary Class in C#
Dictionary in C# is a generic collection class that stores key-value pairs. It belongs to the System.Collections.Generic namespace and provides fast lookups based on keys. Each key in the dictionary must be unique, but values can be duplicated. Syntax Following is the syntax for declaring a Dictionary − public class Dictionary Where TKey is the type of keys and TValue is the type of values in the dictionary. To create and initialize a Dictionary − Dictionary dict = new Dictionary(); dict.Add(key, value); dict[key] = value; // Alternative way to add/update ...
Read MoreDictionary.Values Property in C#
The Dictionary.Values property in C# is used to retrieve all the values stored in a Dictionary. This property returns a ValueCollection that contains all values from the dictionary, preserving the order in which they were added. Syntax Following is the syntax for the Dictionary.Values property − public Dictionary.ValueCollection Values { get; } Return Value The property returns a Dictionary.ValueCollection containing all the values in the dictionary. This collection is a live view of the dictionary values, meaning changes to the dictionary are reflected in the collection. Dictionary.Values Property ...
Read MoreDateTimeOffset.AddYears() Method in C#
The DateTimeOffset.AddYears() method in C# is used to add a specified number of years to a DateTimeOffset instance. This method returns a new DateTimeOffset object representing the date and time with the added years, while preserving the original offset from UTC. Syntax Following is the syntax for the DateTimeOffset.AddYears() method − public DateTimeOffset AddYears(int years); Parameters The method takes one parameter − years − An integer representing the number of years to add. Use positive values to add years, negative values to subtract years. Return Value ...
Read MoreDateTimeOffset.Compare() Method in C#
The DateTimeOffset.Compare() method in C# is used to compare two DateTimeOffset objects and indicates whether the first is earlier than the second, equal to the second, or later than the second. It returns an integer value that represents the relationship between the two dates. 0 − If val1 is later than val2 DateTimeOffset.Compare() Return Values < 0 val1 is earlier than val2 0 val1 equals val2 > 0 ...
Read MoreHow to create 3-Tuple or Triple Tuple in C#?
The Tuple class represents a 3-tuple, also called a triple. A tuple is a data structure that contains a sequence of elements of different types, providing a convenient way to group related data together without creating a custom class. 3-tuples are commonly used for − Easier access to a data set with three related values. Easier manipulation of grouped data. To represent a single set of three related values. To return multiple values from a method. To pass multiple values to a method as a single parameter. ...
Read MoreHow to create 4-Tuple or quadruple in C#?
The Tuple class represents a 4-tuple, which is called a quadruple. A tuple is a data structure that holds a sequence of elements of different types in a single object. 4-tuples are commonly used for − Easier access to a data set. Easier manipulation of a data set. To represent a single set of data. To return multiple values from a method. To pass multiple values to a method. 4-Tuple Structure Item1 Item2 Item3 ...
Read MoreMath.Max() Method in C#
The Math.Max() method in C# returns the larger of two specified numbers. This static method is overloaded to work with various numeric types including int, double, decimal, float, and more. Syntax The Math.Max() method has multiple overloads for different numeric types − public static int Max(int val1, int val2); public static double Max(double val1, double val2); public static decimal Max(decimal val1, decimal val2); public static float Max(float val1, float val2); public static long Max(long val1, long val2); public static byte Max(byte val1, byte val2); public static short Max(short val1, short val2); public static uint Max(uint val1, ...
Read MoreConvert.ToByte(String, IFormatProvider) Method in C#
The Convert.ToByte(String, IFormatProvider) method in C# converts the specified string representation of a number to an equivalent 8-bit unsigned integer, using specified culture-specific formatting information. This method is particularly useful when working with string data from different cultures that may use different number formats, such as different decimal separators or thousand separators. Syntax Following is the syntax − public static byte ToByte(string value, IFormatProvider provider); Parameters value − A string that contains the number to convert. The value must be between 0 and 255. provider − An object ...
Read MoreChar.ConvertFromUtf32(Int32) Method in C#
The Char.ConvertFromUtf32(Int32) method in C# converts a specified Unicode code point into a UTF-16 encoded string. This method is particularly useful when working with Unicode characters that may be represented as numeric code points and need to be converted to their corresponding string representation. Syntax Following is the syntax − public static string ConvertFromUtf32(int utf32); Parameters utf32: A 21-bit Unicode code point representing a valid Unicode character. The valid range is from 0x000000 to 0x10FFFF, excluding the surrogate pair range (0xD800 to 0xDFFF). Return Value Returns a string object consisting of ...
Read More