Programming Articles

Page 107 of 2547

LinkedList AddAfter method in C#

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

The AddAfter method in C# LinkedList allows you to insert a new node immediately after a specified existing node. This method provides precise control over node placement within the linked list structure. Syntax The AddAfter method has two overloads − public LinkedListNode AddAfter(LinkedListNode node, T value) public void AddAfter(LinkedListNode node, LinkedListNode newNode) Parameters node: The existing node after which the new node will be inserted value: The value to be stored in the new node (first overload) newNode: An existing node to be inserted ...

Read More

How to Initialize and Compare Strings in C#?

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 301 Views

String initialization and comparison are fundamental operations in C# programming. C# provides multiple ways to initialize strings and several methods to compare them effectively. String Initialization There are several ways to initialize a string in C# − // Direct assignment string str1 = "Hello, World!"; // Using string constructor string str2 = new string("Welcome"); // Empty string initialization string str3 = ""; string str4 = string.Empty; Example using System; class Program { static void Main(string[] args) { ...

Read More

Selection Sort program in C#

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

Selection Sort is a sorting algorithm that finds the minimum value in the array for each iteration of the loop. Then this minimum value is swapped with the current array element. This procedure is followed until the array is sorted in ascending order. The algorithm divides the array into two parts: a sorted portion (initially empty) and an unsorted portion (initially the entire array). In each iteration, it selects the smallest element from the unsorted portion and moves it to the end of the sorted portion. How Selection Sort Works Selection Sort Process ...

Read More

UInt32 Struct in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 945 Views

The UInt32 struct represents a 32-bit unsigned integer in C#. The UInt32 value type represents unsigned integers with values ranging from 0 to 4, 294, 967, 295 (2³² - 1). This struct provides several useful methods for comparison, equality checking, and value manipulation. Let us explore the key methods with practical examples. Syntax Following is the syntax for declaring a UInt32 variable − uint variableName = value; UInt32 variableName = value; The uint keyword is an alias for UInt32 and both can be used interchangeably. UInt32 Value Range ...

Read More

What are control statements in C#?

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

Control statements in C# determine the flow of program execution by specifying which code blocks to execute based on conditions or how many times to repeat certain operations. These statements are fundamental building blocks that allow developers to create dynamic and responsive applications. C# provides several types of control statements that can be categorized into conditional statements (if, if-else, switch) and loop statements (for, while, do-while, foreach). Let's explore the main control statements with practical examples. if Statement An if statement executes a block of code only when a specified boolean condition evaluates to true. Syntax ...

Read More

String format for DateTime in C#

Samual Sam
Samual Sam
Updated on 17-Mar-2026 503 Views

The String.Format method in C# provides powerful formatting capabilities for DateTime objects. You can use various format specifiers to display dates and times in different formats, from simple year displays to complex custom patterns. Syntax Following is the syntax for formatting DateTime using String.Format − String.Format("{0:format_specifier}", dateTimeObject) Common format specifiers include − y − Year (1 digit minimum) yy − Year (2 digits) yyyy − Year (4 digits) M − Month (1-12) MM − Month (01-12) MMM − Month abbreviation (Jan, Feb, etc.) MMMM − Full month name (January, February, etc.) d ...

Read More

Thread Synchronization in C#

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

Thread synchronization in C# is essential for coordinating access to shared resources in multithreaded applications. It prevents race conditions and ensures data consistency by controlling how multiple threads access critical sections of code. C# provides several synchronization mechanisms including the lock statement, Mutex class, and other primitives to manage concurrent thread execution effectively. Syntax Following is the syntax for using the lock statement − lock (syncObject) { // critical section code } Following is the syntax for creating and using a Mutex − private static Mutex mutex ...

Read More

Char.IsSymbol() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 669 Views

The Char.IsSymbol() method in C# determines whether a specified character is categorized as a symbol character. Symbol characters include mathematical symbols, currency symbols, and other non-alphanumeric characters that are not punctuation or control characters. Syntax The method has two overloads − public static bool IsSymbol(char c); public static bool IsSymbol(string str, int index); Parameters c − The Unicode character to evaluate. str − A string containing the character to evaluate. index − The position of the character to evaluate in the string. Return Value Returns true if the character ...

Read More

DateTime.FromOADate() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 747 Views

The DateTime.FromOADate() method in C# converts an OLE Automation Date value into a DateTime object. OLE Automation Date is a floating-point representation of dates and times where the integer part represents the number of days since December 30, 1899, and the fractional part represents the time of day. Syntax Following is the syntax for the DateTime.FromOADate() method − public static DateTime FromOADate(double d); Parameters The method takes a single parameter − d: A double-precision floating-point number representing the OLE Automation Date value. It can range from -657435.0 to 2958465.99999999. ...

Read More

Replace a C# array with a new array of different size

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

To replace a C# array with a new array of different size, use the Array.Resize method. This method allows you to change the size of an existing array, either expanding or shrinking it while preserving existing elements. Syntax Following is the syntax for using Array.Resize − Array.Resize(ref array, newSize); Parameters array − The array to resize (passed by reference using ref) newSize − The new size of the array How It Works When you resize an array: If the new size is ...

Read More
Showing 1061–1070 of 25,467 articles
« Prev 1 105 106 107 108 109 2547 Next »
Advertisements