Articles on Trending Technologies

Technical articles with clear explanations and examples

How to declare and instantiate Delegates in C#?

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

C# delegates are similar to pointers to functions, in C or C++. A delegate is a reference type variable that holds the reference to a method. The reference can be changed at runtime, making delegates powerful tools for implementing callback methods and event handling. Syntax Following is the syntax for declaring delegates − delegate Following is the syntax for instantiating delegates − delegateInstance = new (MethodName); Delegate Declaration and Instantiation 1. Declare Delegate delegate int ...

Read More

How to find the file using C#?

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

Use the Directory.GetFiles and Directory.GetDirectories methods in C# to search for files in a directory structure. These methods provide powerful options to recursively search through subdirectories and apply search patterns. Syntax Following is the syntax for finding files using Directory.GetFiles − string[] files = Directory.GetFiles(path, searchPattern, SearchOption.AllDirectories); Following is the syntax for finding directories using Directory.GetDirectories − string[] directories = Directory.GetDirectories(path, searchPattern, SearchOption.AllDirectories); Parameters path − The directory path to search in searchPattern − The search string to match file/folder names (supports wildcards like * and ?) SearchOption ...

Read More

Insert more than one element at once in a C# List

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

The InsertRange() method in C# allows you to insert multiple elements into a List at a specified position. This method is useful when you need to add a collection of elements at once rather than adding them one by one. Syntax Following is the syntax for the InsertRange() method − public void InsertRange(int index, IEnumerable collection) Parameters index − The zero-based index at which the new elements should be inserted. collection − The collection whose elements should be inserted into the List. The collection itself cannot be null, but ...

Read More

C# Enum ToString() Method

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

The ToString() method in C# enums converts the enum value to its equivalent string representation. This method provides different formatting options to display enum values as either their names or underlying numeric values. Syntax Following are the common syntax forms for enum ToString() method − enumValue.ToString() // Returns name enumValue.ToString("G") // Returns name (General format) enumValue.ToString("d") // Returns decimal value enumValue.ToString("D") // Returns decimal value Parameters ...

Read More

What are accessors of properties in C#?

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

Properties are an extension of fields and are accessed using the same syntax. They use accessors through which the values of the private fields can be read, written or manipulated. The accessor of a property contains the executable statements that help in getting (reading or computing) or setting (writing) the property. Properties provide a controlled way to access class fields while maintaining encapsulation. Syntax Following is the syntax for property accessors in C# − public datatype PropertyName { get { return fieldName; } ...

Read More

Type.Equals() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 1K+ Views

The Type.Equals() method in C# determines if the underlying system type of the current Type is the same as the underlying system type of the specified Object or Type. This method is essential for type comparison operations in reflection scenarios. Syntax The Type.Equals() method has two overloads − public virtual bool Equals(Type o); public override bool Equals(object o); Parameters o − The object or Type whose underlying system type is to be compared with the underlying system type of the current Type. Return Value Returns true if ...

Read More

Math.Ceiling() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 4K+ Views

The Math.Ceiling() method in C# returns the smallest integer value that is greater than or equal to the specified number. This method always rounds up to the next whole number, making it useful for scenarios where you need to ensure a minimum integer value. Syntax The Math.Ceiling() method has two overloads − public static decimal Ceiling(decimal val); public static double Ceiling(double val); Parameters val − The decimal or double number to be rounded up to the nearest integer. Return Value Returns the smallest integer value greater than ...

Read More

Int64.GetTypeCode Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 223 Views

The Int64.GetTypeCode() method in C# is used to return the TypeCode for value type Int64. This method is inherited from the IConvertible interface and returns TypeCode.Int64 for all 64-bit signed integer values. Syntax Following is the syntax − public TypeCode GetTypeCode(); Return Value This method returns TypeCode.Int64, which is the enumerated constant representing the Int64 type. Using GetTypeCode() with Different Values Example Let us see an example to implement the Int64.GetTypeCode() method − using System; public class Demo { public static void Main() { ...

Read More

Mutation Test tools in C#

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

Mutation testing is a software testing technique that evaluates the quality of your test suite by introducing small code changes (mutations) and checking if your tests can detect these changes. In C#, several tools are available to perform mutation testing effectively. What is Mutation Testing? Mutation testing works by creating mutants − modified versions of your source code with small, intentional bugs. A good test suite should detect these mutations and fail when run against the mutated code. The mutation score represents the percentage of mutants killed (detected) by your tests. Mutation Testing ...

Read More

C# program to merge two Dictionaries

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

Merging dictionaries in C# involves combining two or more Dictionary objects into one. This can be useful when you need to consolidate data from different sources or combine configuration settings. There are several approaches to merge dictionaries, each with different behaviors for handling duplicate keys. Syntax Following is the syntax for creating dictionaries − Dictionary dict = new Dictionary(); Following is the syntax for adding elements − dict.Add(key, value); dict[key] = value; // overwrites if key exists Using HashSet to Merge Keys Only This approach merges only the ...

Read More
Showing 10731–10740 of 61,299 articles
Advertisements