AmitDiwan

AmitDiwan

8,392 Articles Published

Articles by AmitDiwan

Page 185 of 840

MathF.Cbrt() Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 162 Views

The MathF.Cbrt() method in C# is used to return the cube root of a floating-point value. This method is part of the System namespace and works specifically with float data types, providing better performance than the generic Math.Cbrt() method when working with single-precision floating-point numbers. Syntax Following is the syntax − public static float Cbrt(float val); Parameters val − A floating-point number whose cube root is to be calculated. Return Value Returns a float value representing the cube root of the specified number. If the input is NaN (Not ...

Read More

C# Object.GetType() Method with Examples

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

The Object.GetType() method in C# is used to get the runtime type of the current instance. This method is inherited by all types in C# since every type derives from Object. It returns a Type object that contains metadata about the type. Syntax Following is the syntax for the GetType() method − public Type GetType(); Return Value The method returns a Type object that represents the exact runtime type of the current instance. Using GetType() with Built-in Types The GetType() method can be called on any object to determine its type ...

Read More

Get the last node of the LinkedList in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 365 Views

In C#, you can get the last node of a LinkedList using the Last property. This property returns a LinkedListNode object representing the last node in the list, or null if the list is empty. Syntax Following is the syntax to get the last node of a LinkedList − LinkedListNode lastNode = linkedList.Last; T lastValue = linkedList.Last.Value; Using Last Property with String LinkedList The following example demonstrates how to access the last node in a string LinkedList − using System; using System.Collections.Generic; public class Demo { public ...

Read More

MathF.Ceiling() Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 505 Views

The MathF.Ceiling() method in C# is used to find the smallest integer greater than or equal to the specified float value. This method always rounds up to the next integer, even for negative numbers. Syntax Following is the syntax − public static float Ceiling (float val); Parameters val − A floating-point number whose ceiling value is to be calculated. Return Value Returns a float representing the smallest integer that is greater than or equal to the input value. MathF.Ceiling() Visualization ...

Read More

C# Queue.TrimExcess() Method with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 369 Views

The Queue.TrimExcess() method in C# is used to set the capacity to the actual number of elements in the Queue, if that number is less than 90 percent of current capacity. This method helps optimize memory usage by reducing the internal array size when the queue has significantly fewer elements than its current capacity. Syntax public void TrimExcess(); Parameters: This method takes no parameters. Return Value: This method does not return any value (void). How It Works The TrimExcess() method only reduces capacity when the current element count is less than 90% ...

Read More

Get the maximum value in the SortedSet in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 218 Views

The SortedSet class in C# provides the Max property to efficiently retrieve the maximum value from the collection. Since SortedSet maintains elements in sorted order, the maximum element is always the last element in the collection. Syntax Following is the syntax for getting the maximum value from a SortedSet − SortedSet sortedSet = new SortedSet(); T maxValue = sortedSet.Max; Properties Property Description Return Type Max Gets the maximum value in the SortedSet according to the comparer. T Min Gets the minimum value in the ...

Read More

Uri.IsBaseOf(Uri) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 222 Views

The Uri.IsBaseOf() method in C# is used to determine whether the current Uri instance is a base of the specified Uri instance. This method is particularly useful when working with URL hierarchies and checking if one URI is a parent or base path of another URI. Syntax Following is the syntax − public bool IsBaseOf(Uri uri); Parameters uri − The specified Uri instance to test against the current Uri instance. Return Value Returns true if the current Uri instance is a base of the specified Uri; otherwise, false. ...

Read More

C# String Operators

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 641 Views

C# provides several string operators that allow you to perform operations and comparisons on strings. The primary string operators include equality (==), inequality (!=), and the concatenation operator (+). These operators make string manipulation and comparison straightforward and intuitive. Syntax Following is the syntax for string comparison operators − bool result = string1 == string2; // Equality bool result = string1 != string2; // Inequality string result = string1 + string2; // Concatenation String Equality Operator (==) The equality operator checks if two strings have the same content. It performs a ...

Read More

Remove all objects from the Stack in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 229 Views

In C#, the Stack class provides the Clear() method to remove all objects from the Stack. This method efficiently removes every element from the Stack, leaving it empty with a count of zero. Syntax Following is the syntax for removing all objects from a Stack − stack.Clear(); Where stack is the instance of the Stack from which all elements need to be removed. How It Works The Clear()

Read More

C# BitConverter.ToUInt32() Method

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 433 Views

The BitConverter.ToUInt32() method in C# converts four consecutive bytes from a byte array into a 32-bit unsigned integer. This method reads bytes in little-endian format, where the least significant byte comes first. Syntax public static uint ToUInt32(byte[] value, int startIndex); Parameters value − The byte array containing the data to convert. startIndex − The starting position within the byte array (must be between 0 and array length minus 4). Return Value Returns a 32-bit unsigned integer (uint) formed by four bytes beginning at startIndex. Little-Endian ...

Read More
Showing 1841–1850 of 8,392 articles
« Prev 1 183 184 185 186 187 840 Next »
Advertisements