Articles on Trending Technologies

Technical articles with clear explanations and examples

Represent Int32 as a Hexadecimal String in C#

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

To represent Int32 as a hexadecimal string in C#, you can use several methods. The most common approaches are using Convert.ToString() with base 16, or using the ToString() method with hexadecimal format specifiers. Int32 represents a 32-bit signed integer that can hold values from -2, 147, 483, 648 to 2, 147, 483, 647. Converting these values to hexadecimal format is useful for debugging, display purposes, and when working with low-level operations. Using Convert.ToString() with Base 16 The Convert.ToString() method accepts a base parameter. Setting it to 16 converts the integer to its hexadecimal representation − ...

Read More

How to create an infinite loop in C#?

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

An infinite loop is a loop that never terminates and repeats indefinitely. While infinite loops are generally undesirable in most applications, they can be useful in specific scenarios like game loops, server applications, or continuous monitoring systems. There are several ways to create infinite loops in C#, each with different syntax and use cases. Using For Loop The most common way to create an infinite loop is by manipulating the loop condition so it never becomes false − using System; class Program { static void Main(string[] args) { ...

Read More

CharEnumerator.Dispose() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 169 Views

The CharEnumerator.Dispose() method in C# is used to release all resources used by the current instance of the CharEnumerator class. This method implements the IDisposable interface and should be called when you're finished using the enumerator to ensure proper resource cleanup. Syntax Following is the syntax for the CharEnumerator.Dispose() method − public void Dispose(); Parameters This method does not take any parameters. Return Value This method does not return any value (void). Using CharEnumerator.Dispose() Method Example 1: Basic Usage The following example demonstrates how to use the Dispose() ...

Read More

DateTime.GetTypeCode() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 132 Views

The DateTime.GetTypeCode() method in C# is used to return the TypeCode for the DateTime value type. The returned value is the enumerated constant TypeCode.DateTime. This method is inherited from the IConvertible interface and is primarily used in scenarios where you need to determine the type code of a DateTime object programmatically, such as in reflection or type conversion operations. Syntax Following is the syntax − public TypeCode GetTypeCode(); Return Value The method returns TypeCode.DateTime, which is an enumerated constant that represents the DateTime type. Using GetTypeCode() with Current DateTime The ...

Read More

Uri.CheckHostName(String) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 486 Views

The Uri.CheckHostName() method in C# is used to determine the type of hostname specified in a string. It validates whether the given string represents a valid DNS name, IPv4 address, IPv6 address, or an unknown format. Syntax Following is the syntax − public static UriHostNameType CheckHostName(string hostName); Parameters hostName − A string that contains the hostname to validate. Return Value The method returns a UriHostNameType enumeration value that indicates the type of the hostname − UriHostNameType Description Dns Valid ...

Read More

What are floating point literals in C#?

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

A floating-point literal in C# represents a decimal number that can contain a fractional part. It consists of an integer part, a decimal point, a fractional part, and optionally an exponent part. You can represent floating point literals in either decimal form or exponential form. Syntax Following are the different forms of floating-point literal syntax − // Decimal form 123.45 0.5678 // Exponential form 1.23E+2 // 1.23 × 10² 4.56e-3 // 4.56 × 10⁻³ // With type suffixes 3.14f // float 2.718 ...

Read More

Mutation Testing in C#

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

Mutation testing in C# is a technique for evaluating the quality of your test suite by introducing small changes (mutations) to your source code and checking if your tests can detect these changes. If a test fails when the code is mutated, it indicates the test is effective at catching bugs. The primary purpose of mutation testing is to identify weaknesses in your test suite and improve test coverage quality beyond simple line coverage metrics. How Mutation Testing Works Mutation testing follows a systematic process to evaluate test effectiveness − Mutation Testing ...

Read More

SortedMap Interface in C#

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

In C#, there is no direct equivalent to Java's SortedMap interface. However, C# provides the SortedList and SortedDictionary collections which offer similar functionality for maintaining key-value pairs in sorted order. The SortedList collection in C# uses both a key and an index to access items. It combines the features of an array and a hash table, maintaining items in sorted order based on the key values. You can access items either by index (like an ArrayList) or by key (like a Hashtable). Syntax Following is the syntax for creating a SortedList − SortedList sortedList = ...

Read More

How to create custom attributes in C#?

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

Custom attributes in C# allow you to store declarative information about program elements (classes, methods, properties, etc.) that can be retrieved at runtime using reflection. They provide metadata that doesn't affect program execution but can be used for documentation, validation, or configuration purposes. Syntax Following is the basic syntax for creating a custom attribute − [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] public class CustomAttribute : System.Attribute { // constructors and properties } Following is the syntax for applying the custom attribute − [CustomAttribute(parameters)] public class MyClass { // class ...

Read More

Uri.CheckSchemeName(String) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 206 Views

The Uri.CheckSchemeName() method in C# is used to determine whether the specified scheme name is valid. A valid scheme name must start with a letter and can contain only letters, digits, plus (+), period (.), or hyphen (-) characters. Syntax Following is the syntax − public static bool CheckSchemeName(string schemeName); Parameters schemeName − The scheme name to validate as a string. Return Value Returns true if the scheme name is valid; otherwise, false. Valid vs Invalid Scheme Names Valid ...

Read More
Showing 10651–10660 of 61,297 articles
Advertisements