AmitDiwan

AmitDiwan

8,392 Articles Published

Articles by AmitDiwan

Page 217 of 840

Uri.MakeRelativeUri(Uri) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 248 Views

The Uri.MakeRelativeUri(Uri) method in C# is used to determine the relative difference between two Uri instances. It returns a relative URI that, when resolved against the base URI, yields the target URI. Syntax Following is the syntax − public Uri MakeRelativeUri(Uri uri); Parameters uri − The URI to compare to the current URI instance. This represents the target URI for which you want to create a relative path. Return Value Returns a Uri object that represents the relative URI from the current instance to the specified URI. ...

Read More

Uri.ToString() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 306 Views

The Uri.ToString() method in C# is used to get a canonical string representation for the specified Uri instance. This method returns the complete URI as a formatted string, including all components such as scheme, host, path, query, and fragment. Syntax Following is the syntax − public override string ToString(); Return Value This method returns a string that contains the unescaped canonical representation of the Uri instance. All characters are unescaped except #, ?, and %. Using Uri.ToString() Method Basic Example Let us see how to use the Uri.ToString() method to ...

Read More

Double.ToString Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 259 Views

The Double.ToString() method in C# is used to convert the numeric value of this instance to its equivalent string representation. This method provides several overloads to format the double value in different ways, including culture-specific formatting and custom format strings. Syntax Following is the syntax for the basic ToString() method − public override string ToString(); Following is the syntax for ToString() with format specifier − public string ToString(string format); Following is the syntax for ToString() with culture-specific formatting − public string ToString(IFormatProvider provider); Return Value ...

Read More

Decimal.ToString() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 311 Views

The Decimal.ToString() method in C# is used to convert the numeric value of a decimal instance to its equivalent string representation. This method provides various overloads to format the decimal value according to specific requirements. Syntax Following is the basic syntax for Decimal.ToString() method − public override string ToString(); The method also has overloaded versions for custom formatting − public string ToString(string format); public string ToString(IFormatProvider provider); public string ToString(string format, IFormatProvider provider); Parameters format − A standard or custom numeric format string (optional). provider − An object ...

Read More

Math Class Fields with Examples in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 214 Views

The Math class in C# provides essential mathematical constants through predefined fields. The two most commonly used fields are Math.E (Euler's number) and Math.PI (pi), which represent fundamental mathematical constants used in various calculations. These fields are declared as public const double, making them accessible throughout your application without needing to instantiate the Math class. Math.E Field The Math.E field represents Euler's number, which is the natural logarithmic base. This constant is approximately equal to 2.718281828 and is frequently used in exponential and logarithmic calculations. Syntax public const double E = 2.71828182845905; ...

Read More

UInt32.GetTypeCode() Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 164 Views

The UInt32.GetTypeCode() method in C# returns the TypeCode enumeration value for the UInt32 data type. This method is inherited from the IConvertible interface and is used to identify the underlying type of a value at runtime. The TypeCode enumeration provides a way to categorize the fundamental data types in .NET, making it useful for type checking and conversion operations. Syntax Following is the syntax for the UInt32.GetTypeCode() method − public TypeCode GetTypeCode(); Return Value This method returns TypeCode.UInt32, which represents the enumerated constant for the 32-bit unsigned integer type. Using GetTypeCode() ...

Read More

Dictionary.ContainsKey() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 2K+ Views

The Dictionary.ContainsKey() method in C# checks whether the Dictionary contains the specified key. This method returns true if the key exists, otherwise false. Syntax public bool ContainsKey(TKey key); Parameters key − The key to locate in the dictionary. Cannot be null for reference types. Return Value Returns true if the dictionary contains an element with the specified key; otherwise, false. Using ContainsKey() to Check for Existing Keys This example demonstrates checking for a key that exists in the dictionary − using System; using System.Collections.Generic; public class Demo ...

Read More

Dictionary.ContainsValue() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 4K+ Views

The Dictionary.ContainsValue() method in C# is used to check whether the Dictionary contains a specific value or not. This method returns true if the value is found in the dictionary, otherwise it returns false. Syntax public bool ContainsValue(TValue val); Parameters val − The value to search for in the dictionary. This parameter can be null if the value type allows null values. Return Value Returns true if the dictionary contains the specified value; otherwise, false. Using ContainsValue() with Found Value The following example demonstrates checking for a value that exists ...

Read More

UInt32.ToString() Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 2K+ Views

The UInt32.ToString() method in C# is used to convert the numeric value of a UInt32 instance to its equivalent string representation. This method is particularly useful when you need to display unsigned 32-bit integer values as text or concatenate them with strings. The UInt32 type represents unsigned 32-bit integers with values ranging from 0 to 4, 294, 967, 295. The ToString() method provides several overloads to format the output according to different requirements. Syntax Following are the main syntax variations of the UInt32.ToString() method − public override string ToString(); public string ToString(string format); public string ...

Read More

Uri.EscapeDataString(String) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 1K+ Views

The Uri.EscapeDataString() method in C# converts a string to its escaped representation by encoding characters that are not safe for use in URI data strings. This method is essential when you need to include user data or special characters in URL components like query parameters. Syntax Following is the syntax − public static string EscapeDataString(string stringToEscape); Parameters stringToEscape: A string that contains the data to be escaped. If the string is null, the method returns null. Return Value Returns a string that contains the escaped representation of stringToEscape. How It ...

Read More
Showing 2161–2170 of 8,392 articles
« Prev 1 215 216 217 218 219 840 Next »
Advertisements