Articles on Trending Technologies

Technical articles with clear explanations and examples

UInt16 Struct in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 626 Views

The UInt16 struct represents a 16-bit unsigned integer. The UInt16 value type represents unsigned integers with values ranging from 0 to 65, 535. The UInt16 struct provides several useful methods for comparison, equality checking, and string conversion operations. Let us explore the key methods with examples. UInt16.CompareTo() Method The UInt16.CompareTo() method compares the current instance to a specified object or UInt16 and returns an indication of their relative values. Syntax Following are the syntax overloads − public int CompareTo(object val); public int CompareTo(ushort val); Parameters val − An ...

Read More

Socket Programming in C#

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

Socket programming in C# enables network communication between applications using the System.Net.Sockets namespace. This namespace provides a managed implementation of the Windows Sockets interface for creating client-server applications that communicate over TCP/IP networks. Socket programming has two basic modes − synchronous (blocking) and asynchronous (non-blocking) operations. Socket Class Constructor Syntax Following is the syntax for creating a Socket instance − Socket socket = new Socket(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType); Parameters AddressFamily − Specifies the addressing scheme (InterNetwork for IPv4, InterNetworkV6 for IPv6) SocketType − Defines the type ...

Read More

Buffer Type in C#

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 801 Views

The Buffer class in C# provides efficient methods for manipulating arrays of primitive types at the byte level. It is particularly useful when you need to perform fast operations on large arrays or when working with binary data. The Buffer.BlockCopy method is the most commonly used method, which copies bytes from one array to another. Syntax Following is the syntax for the Buffer.BlockCopy method − Buffer.BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count); Parameters src − The source array from which bytes are copied srcOffset − The byte offset into ...

Read More

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 312 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 955 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 7K+ 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 515 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 771 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
Showing 10611–10620 of 61,297 articles
Advertisements