AmitDiwan

AmitDiwan

8,392 Articles Published

Articles by AmitDiwan

Page 210 of 840

Double.CompareTo Method in C# with Examples

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

The Double.CompareTo() method in C# compares the current double instance to another double value or object. It returns an integer that indicates whether the current value is less than, equal to, or greater than the compared value. Syntax Following are the two overloads of the Double.CompareTo() − public int CompareTo(double value); public int CompareTo(object value); Parameters value − A double-precision floating-point number or object to compare with the current instance. Return Value The method returns an integer with the following meaning − Less than ...

Read More

Get the type referenced by the specified type handle in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 285 Views

To get the type referenced by the specified type handle in C#, you use the Type.GetTypeFromHandle() method. This method takes a RuntimeTypeHandle and returns the corresponding Type object. Type handles provide a lightweight way to represent types at runtime and are commonly used in low-level reflection scenarios. Syntax Following is the syntax for getting a type handle and retrieving the type − RuntimeTypeHandle typeHandle = Type.GetTypeHandle(object); Type type = Type.GetTypeFromHandle(typeHandle); Parameters handle − The RuntimeTypeHandle structure that refers to the type. Return Value Returns the Type referenced by the ...

Read More

Double.Equals() Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 402 Views

The Double.Equals() method in C# is used to determine whether two instances of Double represent the same value. This method provides a reliable way to compare double values and handles special cases like NaN (Not a Number) values correctly. Syntax The Double.Equals() method has two overloads − public bool Equals(double obj); public override bool Equals(object obj); Parameters obj (first overload) − A Double value to compare to the current instance. obj (second overload) − An object to compare with the current instance. Return Value Returns true if the specified ...

Read More

Stack.IsSynchronized Property in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 144 Views

The Stack.IsSynchronized property in C# is used to get a value indicating whether access to the Stack is synchronized (thread-safe). This property returns false for the standard Stack class, as it is not thread-safe by default. Syntax Following is the syntax of the IsSynchronized property − public virtual bool IsSynchronized { get; } Return Value This property returns true if the Stack is synchronized (thread-safe); otherwise, it returns false. For the default Stack implementation, this property always returns false. Understanding Thread Safety in Stack The standard Stack class is not thread-safe, ...

Read More

Stack.Peek() Method in C#

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

The Stack.Peek() method in C# is used to return the object at the top of the Stack without removing it. This method is essential when you need to examine the top element while keeping the stack structure intact. Syntax Following is the syntax for the Stack.Peek() method − public virtual object Peek(); Return Value The method returns the object at the top of the Stack. If the stack is empty, it throws an InvalidOperationException. Stack.Peek() Operation Item 3 ...

Read More

C# Int16 Struct

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 562 Views

The Int16 Struct in C# represents a 16-bit signed integer with values ranging from -32, 768 to 32, 767. It is also commonly known as the short data type and is part of the .NET value types that directly inherit from System.ValueType. Int16 Value Range -32, 768 MinValue 0 32, 767 MaxValue Fields The Int16 struct provides two important constant fields − ...

Read More

How to create a StringDictionary in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 146 Views

The StringDictionary in C# is a specialized collection class from the System.Collections.Specialized namespace that stores key-value pairs where both keys and values are strings. It's important to note that StringDictionary is case-insensitive and automatically converts all keys to lowercase. Note: StringDictionary is considered legacy and is generally replaced by Dictionary in modern C# applications. However, understanding StringDictionary is useful for maintaining older codebases. Syntax Following is the syntax for creating and using a StringDictionary − StringDictionary stringDict = new StringDictionary(); stringDict.Add("key", "value"); string value = stringDict["key"]; StringDictionary Key Conversion ...

Read More

How to find the length of the StringBuilder in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 327 Views

The StringBuilder class in C# provides the Length property to determine the number of characters currently stored in the StringBuilder object. This property is essential for string manipulation operations and memory management. Syntax Following is the syntax to get the length of a StringBuilder − int length = stringBuilder.Length; Understanding Length vs Capacity It's important to distinguish between Length and Capacity of a StringBuilder − Property Description Length Number of characters currently stored in the StringBuilder Capacity Maximum number of characters the StringBuilder ...

Read More

C# Int32 Struct

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 676 Views

The Int32 struct in C# represents a 32-bit signed integer. It is an immutable value type that represents signed integers with values ranging from -2, 147, 483, 648 to 2, 147, 483, 647. The int keyword in C# is an alias for Int32. This struct provides various fields and methods for working with 32-bit integers, including comparison, parsing, and conversion operations. Syntax Following is the syntax for declaring an Int32 variable − int variableName = value; Int32 variableName = value; Fields The Int32 struct provides two important constant fields − ...

Read More

C# Int16.ToString() Method

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 261 Views

The Int16.ToString() method in C# is used to convert a 16-bit signed integer (short) to its equivalent string representation. This method provides multiple overloads to format the output string according to your specific requirements. Syntax Following are the different overloads of the Int16.ToString() method − public override string ToString(); public string ToString(string format); public string ToString(IFormatProvider provider); public string ToString(string format, IFormatProvider provider); Parameters format − A numeric format string that specifies the format of the return value. provider − An object that supplies culture-specific formatting information. ...

Read More
Showing 2091–2100 of 8,392 articles
« Prev 1 208 209 210 211 212 840 Next »
Advertisements