Articles on Trending Technologies

Technical articles with clear explanations and examples

Merge two arrays using C# AddRange() method

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

The AddRange() method in C# is used to add elements from a collection to the end of a List. This method is particularly useful for merging arrays by first converting them to a list, adding both arrays using AddRange(), and then converting the result back to an array. Syntax Following is the syntax for the AddRange() method − public void AddRange(IEnumerable collection) Parameters collection − The collection whose elements should be added to the end of the List. The collection itself cannot be null, but it can contain elements that are null. ...

Read More

C# program to remove the first occurrence of a node in a Linked List

George John
George John
Updated on 17-Mar-2026 196 Views

The LinkedList class in C# provides an efficient way to store and manipulate collections of data. When you need to remove the first occurrence of a specific node from a LinkedList, you can use the Remove() method, which searches for the specified value and removes its first occurrence. Syntax The syntax for removing the first occurrence of a node from a LinkedList is − bool result = linkedList.Remove(value); Parameters value − The value to remove from the LinkedList. The method removes the first node that contains this value. Return Value The Remove()

Read More

C# program to implement FizzBuzz

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

The FizzBuzz problem is a classic programming exercise that involves printing numbers from 1 to 100 with specific replacements. If a number is divisible by 3, print "Fizz". If divisible by 5, print "Buzz". If divisible by both 3 and 5, print "FizzBuzz". Otherwise, print the number itself. This problem tests your understanding of conditional statements, loops, and the modulo operator in C#. Syntax The modulo operator % is used to check divisibility − if (number % divisor == 0) { // number is divisible by divisor } The logical ...

Read More

CharEnumerator.Clone() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 149 Views

The CharEnumerator.Clone() method in C# is used to create a copy of the current CharEnumerator object. This method returns an object that must be cast to CharEnumerator to use its functionality. The cloned enumerator maintains the same position as the original enumerator at the time of cloning. Syntax public object Clone(); Return Value Returns an object that is a copy of the current CharEnumerator instance. The returned object must be cast to CharEnumerator to access enumerator-specific methods. Using CharEnumerator.Clone() The following example demonstrates how to create and use a cloned CharEnumerator − ...

Read More

UInt64.ToString() Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 556 Views

The UInt64.ToString() method in C# is used to convert the numeric value of the current UInt64 instance to its equivalent string representation. This method is particularly useful when you need to display UInt64 values as text or perform string operations on numeric data. Syntax Following is the syntax for the parameterless overload − public override string ToString(); The method also has additional overloads for custom formatting − public string ToString(string format); public string ToString(IFormatProvider provider); public string ToString(string format, IFormatProvider provider); Return Value Returns a string that represents the ...

Read More

What are different methods of passing parameters in C#?

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

When a method with parameters is called, you need to pass the parameters to the method using one of the following three methods in C# − Value Parameters (Default) This method copies the actual value of an argument into the formal parameter of the function. Changes made to the parameter inside the function have no effect on the original argument because the method works with a copy of the value. Value Parameters - Copy by Value Main Method int a = 7 int b ...

Read More

What are string literals in C#?

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

String literals in C# are constant string values enclosed in double quotes "" or prefixed with @"" for verbatim strings. A string literal contains characters that can include plain text, escape sequences, and Unicode characters. Types of String Literals C# supports several types of string literals − Regular String Literals: Enclosed in double quotes with escape sequences Verbatim String Literals: Prefixed with @ symbol, allowing multi-line strings and literal backslashes Raw String Literals: (C# 11+) Use triple quotes """ for complex strings Syntax Following are the different syntaxes for string literals − ...

Read More

Overloaded method and ambiguity in C#

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

With method overloading, you can have multiple definitions for the same function name in the same scope. The definition of the function must differ from each other by the types and/or the number of arguments in the argument list. However, when using default parameters with overloaded methods, ambiguity can occur if the compiler cannot determine which method to call. Syntax Following is the syntax for method overloading − public void MethodName(int parameter1) { // Implementation 1 } public void MethodName(int parameter1, int parameter2) { // Implementation 2 ...

Read More

Sort the words in lexicographical order in C#

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

Lexicographical order means sorting strings alphabetically, similar to how words are arranged in a dictionary. In C#, there are multiple ways to sort an array of strings in lexicographical order using built-in methods and LINQ. Syntax Using LINQ query syntax − var sorted = from word in array orderby word select word; Using Array.Sort() method − Array.Sort(array); Using LINQ OrderBy() method − ...

Read More

C# program to copy a range of bytes from one array to another

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

The Buffer.BlockCopy method in C# is used to copy a range of bytes from one array to another. This method provides a fast, low-level approach for copying data between arrays and is particularly useful when working with byte arrays or when you need to copy a specific range of elements. Syntax Following is the syntax for the Buffer.BlockCopy method − Buffer.BlockCopy(sourceArray, sourceOffset, destinationArray, destinationOffset, count); Parameters sourceArray − The source array from which to copy bytes sourceOffset − The zero-based byte offset into the source array destinationArray − The destination array to ...

Read More
Showing 10641–10650 of 61,297 articles
Advertisements