Check whether the Unicode character is a separator character in C#

AmitDiwan
Updated on 17-Mar-2026 07:04:36

304 Views

The Char.IsSeparator() method in C# determines whether a Unicode character belongs to the separator category. Unicode separator characters are used to separate words, lines, or paragraphs in text, such as spaces, line separators, and paragraph separators. Syntax Following is the syntax for the Char.IsSeparator() method − public static bool IsSeparator(char c) public static bool IsSeparator(string s, int index) Parameters c − The Unicode character to evaluate. s − A string containing the character to evaluate. index − The position of the character to evaluate in the string. Return Value ... Read More

What is the difference between IEnumerable and IQueryable in C#?

Nizamuddin Siddiqui
Updated on 17-Mar-2026 07:04:36

10K+ Views

The IEnumerable and IQueryable interfaces are both used for querying collections in C#, but they differ significantly in how they execute queries and handle data. Understanding these differences is crucial for writing efficient database queries and managing memory usage. Key Differences Feature IEnumerable IQueryable Namespace System.Collections System.Linq Query Execution In-memory (client-side) Server-side (database) Lazy Loading Not supported Supported Extension Methods Use functional objects Use expression trees Best For In-memory collections Database queries Syntax Following is the syntax for ... Read More

How to implement interface in anonymous class in C#?

Nizamuddin Siddiqui
Updated on 17-Mar-2026 07:04:36

2K+ Views

No, anonymous types cannot implement an interface. We need to create your own type. Anonymous types provide a convenient way to encapsulate a set of read-only properties into a single object without having to explicitly define a type first. The type name is generated by the compiler and is not available at the source code level. The type of each property is inferred by the compiler. Syntax Following is the syntax for creating anonymous types − var anonymousObject = new { Property1 = value1, Property2 = value2 }; Why Anonymous Types Cannot Implement ... Read More

Capacity of a SortedList in C#

AmitDiwan
Updated on 17-Mar-2026 07:04:36

220 Views

The Capacity property of a SortedList in C# represents the maximum number of key-value pairs that the SortedList can hold without needing to resize its internal storage. This is different from the Count property, which shows the actual number of elements currently stored. When elements are added to a SortedList, the capacity automatically grows to accommodate new items. The capacity typically doubles when the current capacity is exceeded, following a geometric growth pattern to optimize performance. Syntax Following is the syntax to get the capacity of a SortedList − int capacity = sortedList.Capacity; ... Read More

What is bin and obj folder in C#?

Nizamuddin Siddiqui
Updated on 17-Mar-2026 07:04:36

1K+ Views

Whenever we write a C# code and build or run the solution, it generates 2 folders − bin folder obj folder These folders contain compiled code at different stages of the compilation process. Understanding the difference between them is crucial for C# developers working with build systems and deployment. Why Two Folders? The compilation process in C# goes through multiple stages, which is why we have separate folders for different outputs − Compiling − Individual source files are compiled into intermediate objects Linking − All compiled objects are linked together into the ... Read More

What is difference between using if/else and switch-case in C#?

Nizamuddin Siddiqui
Updated on 17-Mar-2026 07:04:36

555 Views

The switch statement and if-else statements are both selection statements in C# used for decision-making, but they serve different purposes and have distinct performance characteristics. The switch statement chooses a single section to execute from a list of candidates based on pattern matching, while if-else provides conditional branching based on boolean expressions. Syntax Following is the syntax for a switch statement − switch (expression) { case value1: // code block break; case ... Read More

What is #if DEBUG and How to use it in C#?

Nizamuddin Siddiqui
Updated on 17-Mar-2026 07:04:36

11K+ Views

In Visual Studio, Debug mode and Release mode are different configurations for building your .NET project. The #if DEBUG directive is a preprocessor conditional compilation directive that allows you to include or exclude code blocks based on whether the DEBUG symbol is defined. The Debug mode does not optimize the binary it produces because the relationship between source code and generated instructions is more complex. This allows breakpoints to be set accurately and allows programmers to step through the code one line at a time. The Debug configuration compiles with full symbolic debug information, while the Release configuration has ... Read More

What are the improvements in Out Parameter in C# 7.0?

Nizamuddin Siddiqui
Updated on 17-Mar-2026 07:04:36

256 Views

C# 7.0 introduced significant improvements to out parameters that make code more concise and readable. The major enhancement is the ability to declare out variables inline as arguments to the method where they're used, eliminating the need for separate variable declarations. Syntax Prior to C# 7.0, out variables had to be declared before use − int result; if (int.TryParse("123", out result)) { // use result } C# 7.0 allows inline declaration − if (int.TryParse("123", out int result)) { // use result immediately } Key ... Read More

Queue.Clear Method in C#

AmitDiwan
Updated on 17-Mar-2026 07:04:36

291 Views

The Queue.Clear() method in C# is used to remove all elements from a Queue collection. This method provides an efficient way to empty the entire queue in a single operation, setting the count to zero. Syntax Following is the syntax for the Clear() method − public void Clear(); Parameters The Clear() method does not take any parameters. Return Value The method does not return any value. It is a void method that modifies the queue in place. Queue.Clear() Operation ... Read More

How to subscribe to an Event in C# and can we have multiple subscribers to one Event in a C#?

Nizamuddin Siddiqui
Updated on 17-Mar-2026 07:04:36

3K+ Views

Events enable a class or object to notify other classes or objects when something of interest occurs. The class that raises the event is called the publisher and the classes that handle the event are called subscribers. An event can have multiple subscribers, and a subscriber can handle multiple events from multiple publishers. Events that have no subscribers are never raised. The publisher determines when an event is raised; the subscribers determine what action is taken in response to the event. Syntax Following is the syntax for declaring an event using EventHandler − public event ... Read More

Advertisements