Programming Articles

Page 807 of 2547

Type.Equals() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 941 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 183 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 385 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

Get the range of elements in a C# list

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

The GetRange() method in C# is used to extract a subset of elements from a List. This method returns a new list containing the specified range of elements from the original list, without modifying the original list. Syntax Following is the syntax for the GetRange() method − public List GetRange(int index, int count) Parameters index − The zero-based starting index of the range to extract. count − The number of elements to extract from the starting index. Return Value Returns a new List containing the specified range of elements. ...

Read More

C# Enum Parse Method

Ankith Reddy
Ankith Reddy
Updated on 17-Mar-2026 2K+ Views

The Enum.Parse method in C# converts the string representation of an enum constant name or its numeric value into an equivalent enumerated object. This method is essential when you need to convert string data back into strongly-typed enum values. Syntax Following are the main syntax forms for Enum.Parse − // Basic syntax public static object Parse(Type enumType, string value) // With ignore case option public static object Parse(Type enumType, string value, bool ignoreCase) Parameters enumType − The type of the enumeration to parse to value − A string containing the name ...

Read More

What are Add, Remove methods in C# lists?

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

The List is a generic collection in C# that provides dynamic array functionality. The Add() and Remove() methods are fundamental operations for managing elements in a list, allowing you to add new items and remove existing ones efficiently. Syntax Following is the syntax for adding elements to a list − List listName = new List(); listName.Add(item); Following is the syntax for removing elements from a list − bool result = listName.Remove(item); listName.RemoveAt(index); Using Add() Method The Add() method appends an element to the end of the list. It increases ...

Read More

Shell Sort program in C#

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

Shell Sort is an optimized version of insertion sort that allows the exchange of items that are far apart in the array. It starts with a large gap between compared elements and progressively reduces this gap until it becomes 1. This algorithm was developed by Donald Shell in 1959, hence the name. Unlike insertion sort which compares adjacent elements, Shell Sort compares elements separated by a gap. This reduces the number of shifts needed and makes the algorithm more efficient for larger datasets. How Shell Sort Works Shell Sort works by dividing the array into smaller sub-arrays ...

Read More

Type.GetArrayRank() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 144 Views

The Type.GetArrayRank() method in C# returns the number of dimensions in an array type. This method is useful when working with multidimensional arrays and you need to determine how many dimensions the array has at runtime. The method works only with array types. If called on a non-array type, it throws an ArgumentException. Syntax Following is the syntax for the GetArrayRank() method − public virtual int GetArrayRank(); Return Value The method returns an int representing the number of dimensions in the array. For example, a single-dimensional array returns 1, a two-dimensional array ...

Read More
Showing 8061–8070 of 25,466 articles
« Prev 1 805 806 807 808 809 2547 Next »
Advertisements