Articles on Trending Technologies

Technical articles with clear explanations and examples

Decimal.ToUInt32() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 128 Views

The Decimal.ToUInt32() method in C# is used to convert the value of the specified Decimal to the equivalent 32-bit unsigned integer. This method performs truncation, discarding the fractional part and returning only the integer portion. Syntax Following is the syntax − public static uint ToUInt32(decimal val); Parameters val − The decimal number to convert to a 32-bit unsigned integer. Return Value Returns a 32-bit unsigned integer (uint) that represents the truncated value of the specified decimal. The fractional part is discarded. How It Works The method converts a decimal ...

Read More

Char.GetNumericValue() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 683 Views

The Char.GetNumericValue() method in C# converts a specified Unicode character to its corresponding numeric value as a double. This method is particularly useful when working with Unicode digits from various scripts and numeral systems. Syntax Following is the syntax for the Char.GetNumericValue() method − public static double GetNumericValue(char ch); Parameters ch − A Unicode character to convert to its numeric value. Return Value The method returns a double representing the numeric value of the character. If the character does not represent a numeric digit, it returns -1. ...

Read More

Time Functions in C#

Chandu yadav
Chandu yadav
Updated on 17-Mar-2026 1K+ Views

The DateTime structure in C# provides numerous methods and properties for working with dates and times. These time functions allow you to manipulate DateTime instances by adding or subtracting specific time intervals, extracting time components, and performing various time-related operations. Time functions in C# are essential for applications that need to handle scheduling, logging, time calculations, and date arithmetic operations. Common Time Functions The following table shows the most commonly used time manipulation methods in the DateTime class − Method Description AddDays(Double) Returns a new DateTime that adds the ...

Read More

What is index-based I/O BitArray collection in C#?

Chandu yadav
Chandu yadav
Updated on 17-Mar-2026 249 Views

The BitArray class in C# manages a compact array of bit values represented as Boolean values, where true indicates the bit is on (1) and false indicates the bit is off (0). It is part of the System.Collections namespace and provides an efficient way to store and manipulate bits. BitArray is particularly useful for scenarios requiring bitwise operations, boolean flags, or when memory efficiency is crucial since it stores bits compactly rather than using full bytes for each boolean value. Syntax Following is the syntax for creating a BitArray − BitArray bitArray = new BitArray(size); ...

Read More

C# program to remove an item from Set

Chandu yadav
Chandu yadav
Updated on 17-Mar-2026 318 Views

A HashSet in C# is a collection that stores unique elements and provides efficient methods to add, remove, and search items. To remove items from a HashSet, you can use methods like Remove(), RemoveWhere(), or Clear(). Syntax Following are the common methods to remove items from a HashSet − // Remove a specific item bool removed = hashSet.Remove(item); // Remove items based on a condition int count = hashSet.RemoveWhere(predicate); // Remove all items hashSet.Clear(); Using Remove() Method The Remove() method removes a specific item from the HashSet and returns true if ...

Read More

C# Program to get the difference between two dates in seconds

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 7K+ Views

In C#, you can calculate the difference between two dates in seconds using the TimeSpan structure. When you subtract one DateTime from another, it returns a TimeSpan object that represents the time interval between them. Syntax Following is the syntax for calculating date difference in seconds − DateTime date1 = new DateTime(year, month, day, hour, minute, second); DateTime date2 = new DateTime(year, month, day, hour, minute, second); TimeSpan difference = date2 - date1; double seconds = difference.TotalSeconds; Using DateTime Subtraction The most straightforward approach is to subtract one DateTime from another, which returns ...

Read More

Decimal.ToUInt64() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 89 Views

The Decimal.ToUInt64() method in C# converts a decimal value to a 64-bit unsigned integer (ulong). This method performs truncation, meaning it removes the fractional part and returns only the integer portion of the decimal number. Syntax Following is the syntax − public static ulong ToUInt64(decimal value); Parameters value − The decimal number to convert to a 64-bit unsigned integer. Return Value Returns a ulong (64-bit unsigned integer) that represents the truncated value of the specified decimal. Decimal to UInt64 Conversion ...

Read More

How to display Absolute value of a number in C#?

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 3K+ Views

To find the absolute value of a number in C#, use the Math.Abs method. The absolute value represents the distance of a number from zero on the number line, always returning a non-negative result. Syntax The Math.Abs method is overloaded to work with different numeric types − Math.Abs(int value) Math.Abs(long value) Math.Abs(float value) Math.Abs(double value) Math.Abs(decimal value) Parameters value − The number whose absolute value is to be computed. Return Value Returns the absolute value of the specified number. If the number is positive or zero, it ...

Read More

C# program to remove all duplicates words from a given sentence

George John
George John
Updated on 17-Mar-2026 1K+ Views

Removing duplicate words from a sentence is a common string manipulation task in C#. This process involves splitting the sentence into individual words, identifying duplicates, and keeping only unique words while preserving the original structure. There are several approaches to accomplish this task, ranging from using LINQ's Distinct() method to using collections like HashSet for efficient duplicate removal. Using LINQ Distinct() Method The Distinct() method from LINQ provides a straightforward way to remove duplicates from a collection − using System; using System.Linq; public class Program { public static void Main() { ...

Read More

Scope of Variables in C#

Samual Sam
Samual Sam
Updated on 17-Mar-2026 1K+ Views

The scope of a variable in C# determines the region of code where a variable can be accessed and used. Understanding variable scope is crucial for writing efficient and error-free programs. C# has several levels of variable scope, each with different accessibility rules and lifetimes. Types of Variable Scope Method Level (Local Variables) Variables declared inside a method are local variables. They are only accessible within that specific method and are destroyed when the method execution completes − using System; class Program { public void TestMethod() { ...

Read More
Showing 10431–10440 of 61,297 articles
Advertisements