Articles on Trending Technologies

Technical articles with clear explanations and examples

How to replace line breaks in a string in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 2K+ Views

In C#, you often need to remove or replace line breaks from strings when processing text data. Line breaks can appear as (line feed), \r (carriage return), or \r (Windows-style line endings). This article demonstrates different approaches to handle line breaks in strings. Common Line Break Characters Different operating systems use different line break characters − − Line Feed (LF), used on Unix/Linux/Mac \r − Carriage Return (CR), used on older Mac systems \r − Carriage Return + Line Feed (CRLF), used on Windows Line Break Types ...

Read More

Get the TypeCode for value type Char in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 267 Views

The TypeCode for a char value type in C# can be obtained using the GetTypeCode() method. This method returns TypeCode.Char, which is an enumeration value that identifies the char data type. The GetTypeCode() method is inherited from the IConvertible interface and provides a way to determine the underlying type of a value at runtime. Syntax Following is the syntax to get the TypeCode for a char value − TypeCode typeCode = charVariable.GetTypeCode(); Return Value The method returns TypeCode.Char for char data types, which is part of the TypeCode enumeration. Using GetTypeCode() ...

Read More

How to get all elements of a List that match the conditions specified by the predicate in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 707 Views

To get all elements of a List that match specific conditions, C# provides the FindAll method which accepts a predicate − a delegate that defines the filtering criteria. This method returns a new List containing only the elements that satisfy the condition. Syntax Following is the syntax for using FindAll with a predicate − List result = list.FindAll(predicate); The predicate can be defined as a method, lambda expression, or anonymous delegate − // Method predicate private static bool MethodName(T item) { return condition; } // Lambda expression predicate ...

Read More

Executing C# code in Linux

Ajay yadav
Ajay yadav
Updated on 17-Mar-2026 6K+ Views

The .NET ecosystem was traditionally limited to Windows, but Microsoft's introduction of Mono changed this landscape. Mono enables the execution of .NET applications on Linux systems, making them run as if they were native Linux packages rather than Windows executable files. What is Mono? Mono is an open-source, cross-platform implementation of Microsoft's .NET Framework. It allows developers to run .NET applications on various platforms including Linux and macOS. Mono provides a complete development stack that supports Windows Forms, LINQ, XML web services, ADO.NET, and ASP.NET using the same CLR namespaces. Cross-Platform .NET with ...

Read More

How to find items in one list that are not in another list in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 15K+ Views

Finding items in one list that are not present in another list is a common task in C# programming. LINQ provides multiple approaches to solve this problem, with the Except() method being the most straightforward for simple data types and the Where() clause being more flexible for complex objects. Syntax Using the Except() method for simple types − var result = list1.Except(list2); Using Where() clause with All() for complex objects − var result = list1.Where(item1 => list2.All(item2 => condition)); Using Except() Method The Except() method is a LINQ set ...

Read More

Check whether the specified Unicode character is a letter or a decimal digit in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 237 Views

To check whether the specified Unicode character is a letter or a decimal digit in C#, use the Char.IsLetterOrDigit() method. This method returns true if the character is a letter (uppercase or lowercase) or a decimal digit (0-9), and false otherwise. Syntax Following is the syntax for the Char.IsLetterOrDigit() method − public static bool IsLetterOrDigit(char c) Parameters c: The Unicode character to evaluate. Return Value Returns true if the character is a letter or decimal digit; otherwise, false. Using IsLetterOrDigit with Decimal Digits Example ...

Read More

How to get the HashCode of the tuple in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 246 Views

To get the HashCode of a tuple in C#, you can use the GetHashCode() method. This method returns an integer hash code that represents the tuple's value. Tuples with identical values will have the same hash code, while tuples with different values will typically have different hash codes. Syntax Following is the syntax for getting the hash code of a tuple − int hashCode = tuple.GetHashCode(); Return Value The GetHashCode() method returns a 32-bit signed integer that serves as a hash code for the tuple. Equal tuples will always return the same hash ...

Read More

Check whether the Unicode character is a lowercase letter in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 311 Views

To check whether a Unicode character is a lowercase letter in C#, we use the Char.IsLower() method. This method examines the Unicode character and returns true if it represents a lowercase letter according to Unicode standards, and false otherwise. Syntax Following is the syntax for the Char.IsLower() method − public static bool IsLower(char c) Parameters c − The Unicode character to evaluate Return Value The method returns a bool value − true if the character is a lowercase letter false if the character is not a lowercase ...

Read More

Difference between Method Overriding and Method Hiding in C#

Nitin Sharma
Nitin Sharma
Updated on 17-Mar-2026 3K+ Views

In C#, there are two mechanisms for redefining or providing new implementation of a method from a parent class in its child class: Method Overriding and Method Hiding. Understanding the difference between these concepts is crucial for implementing proper inheritance and polymorphism. Method overriding uses the override keyword and enables runtime polymorphism, while method hiding uses the new keyword and provides compile-time method resolution. Syntax Following is the syntax for method overriding − public class BaseClass { public virtual void Method() { } } public class DerivedClass : BaseClass { ...

Read More

How can we return null from a generic method in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 2K+ Views

Generics in C# allow us to define classes and methods with placeholders for types, which are replaced with specific types at compile time. However, returning null from a generic method requires special handling because the compiler cannot determine whether the generic type T is a reference type or value type. When you try to return null directly from a generic method, you'll encounter a compilation error because null cannot be assigned to value types like int, double, etc. The Problem Here's what happens when we try to return null directly from a generic method − ...

Read More
Showing 9731–9740 of 61,297 articles
« Prev 1 972 973 974 975 976 6130 Next »
Advertisements