Articles on Trending Technologies

Technical articles with clear explanations and examples

BitConverter.ToBoolean() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 216 Views

The BitConverter.ToBoolean() method in C# returns a Boolean value converted from the byte at a specified position in a byte array. This method reads a single byte and returns true if the byte is non-zero, or false if the byte is zero. Syntax Following is the syntax − public static bool ToBoolean(byte[] value, int startIndex); Parameters value − An array of bytes. startIndex − The starting position within the byte array. Return Value Returns true if the byte at startIndex in the array is non-zero; otherwise, false. ...

Read More

Int64.CompareTo Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 281 Views

The Int64.CompareTo() method in C# is used to compare the current long instance with a specified object or Int64 value and returns an integer indicating their relative values. This method is essential for sorting operations and value comparisons. Syntax The Int64.CompareTo() method has two overloads − public int CompareTo(long value); public int CompareTo(object value); Parameters value − In the first overload, it's a long integer to compare. In the second overload, it's an object to compare, which must be null or an instance of Int64. Return Value The method ...

Read More

Iterators in C#

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

An iterator in C# performs custom iteration over a collection using the yield keyword. It returns elements one at a time and remembers its current position, making it memory-efficient for large datasets. Iterators implement lazy evaluation, meaning values are generated only when requested. Syntax Following is the syntax for creating an iterator method − public static IEnumerable MethodName() { // logic here yield return value; // more logic yield return anotherValue; } The yield break statement can be ...

Read More

What are generic delegates in C#?

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

Generic delegates in C# allow you to create delegate types with type parameters, providing flexibility to work with different data types without defining separate delegate declarations for each type. The .NET Framework provides several built-in generic delegates in the System namespace that eliminate the need for custom delegate definitions in most scenarios. Syntax Following is the syntax for declaring a custom generic delegate − delegate TResult DelegateName(T parameter); Built-in generic delegates use these syntaxes − Action actionDelegate = method; // void return type Func funcDelegate = method; // ...

Read More

Private Constructors and Singleton Classes in C#

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

A private constructor is a constructor that cannot be called from outside the class. It is primarily used in classes containing only static members or to implement the Singleton design pattern, which ensures that only one instance of a class can exist throughout the application's lifetime. Syntax Following is the syntax for declaring a private constructor − class ClassName { private ClassName() { // private constructor body } } Private Constructor for Static-Only Classes When a class contains only static members, ...

Read More

Clear a list in C#

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

To clear a list in C#, you use the Clear() method which removes all elements from the list. This method is part of the List class and provides an efficient way to empty a list without recreating it. Syntax Following is the syntax for the Clear()

Read More

C# Program to remove a node at the end of the Linked List

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

In C#, you can remove the last node from a LinkedList using the RemoveLast() method. This method removes and returns the last node in the linked list, making it an efficient way to delete the tail element. Syntax Following is the syntax for removing the last node from a LinkedList − linkedList.RemoveLast(); The RemoveLast() method removes the last node and has no return value. If the list is empty, it throws an InvalidOperationException. How It Works The LinkedList class maintains references to both the first and last nodes. When RemoveLast() is called, ...

Read More

C# program to perform Quick sort using Recursion

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

Quick Sort is a highly efficient sorting algorithm that uses the divide and conquer approach. It selects a pivot element from the array and partitions the other elements into two sub-arrays according to whether they are less than or greater than the pivot. The sub-arrays are then recursively sorted. The algorithm works by placing the pivot in its correct position and then recursively applying the same process to the left and right sub-arrays until the entire array is sorted. How Quick Sort Works Quick Sort Process Initial Array: ...

Read More

Boolean.CompareTo(Boolean) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 674 Views

The Boolean.CompareTo(Boolean) method in C# is used to compare the current Boolean instance with another Boolean object and returns an integer indicating their relative values. Syntax Following is the syntax − public int CompareTo(bool value); Parameters value − A Boolean object to compare with the current instance. Return Value The method returns an integer value − -1 − if the current instance is false and value is true 0 − if the current instance and value are equal 1 − if the current instance ...

Read More

How to write the first program in C#?

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

Writing your first program in C# is the foundation of learning this powerful programming language. A C# program consists of several key components that work together to produce output. Let's explore the structure and elements of a basic C# program. Syntax Following is the basic structure of a C# program − using System; namespace NamespaceName { class ClassName { static void Main(string[] args) { // Program logic here ...

Read More
Showing 10681–10690 of 61,297 articles
Advertisements