Csharp Articles

Page 102 of 196

Thread Pools in C#

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

A thread pool in C# is a collection of pre-created threads that can be reused to execute multiple tasks efficiently. Instead of creating new threads for each task, the thread pool manages a pool of worker threads, reducing the overhead of thread creation and destruction. The ThreadPool class in the System.Threading namespace provides methods to queue work items for execution by background threads. When a thread completes its task, it returns to the pool and waits for the next available work item. Syntax Following is the syntax for queuing work items to the thread pool − ...

Read More

What are multicasting delegates in C#?

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

A multicasting delegate in C# is a delegate that holds references to multiple methods. When invoked, it calls all the methods in its invocation list sequentially. This is achieved using the += operator to add methods and -= operator to remove methods from the delegate. Multicasting delegates are particularly useful for implementing event-like behavior where multiple handlers need to be executed when a single event occurs. Syntax Following is the syntax for declaring a multicasting delegate − delegate returnType DelegateName(parameters); Adding and removing methods from a multicasting delegate − DelegateName del ...

Read More

What are extender provider components in C#?

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

An extender provider in C# is a component that can extend other controls by providing additional properties to them at design time. The most common example is the ToolTip component, which adds tooltip functionality to other controls on a form. When you add a ToolTip component to a form, it automatically provides a new property (like "ToolTip on toolTip1") to every other control on the form. This allows you to set tooltip text for each control without directly modifying the control itself. How Extender Providers Work Extender providers implement the IExtenderProvider interface and use special naming conventions ...

Read More

What are punctuators in C#?

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

Punctuators are special symbols in C# that serve as delimiters to structure, group, and organize code. They are essential for proper syntax and help the compiler understand where statements begin and end, how to group code blocks, and how to separate elements. Common Punctuators in C# The most frequently used punctuators in C# include − { } // Braces - code blocks ( ) // Parentheses - method calls, grouping [ ] // Brackets - arrays, indexers ; // Semicolon - statement terminator , ...

Read More

What are sealed modifiers in C#?

Ankith Reddy
Ankith Reddy
Updated on 17-Mar-2026 553 Views

The sealed modifier in C# prevents method overriding in derived classes. When applied to an overridden method, it stops further inheritance of that method. The sealed method must be part of a derived class and must override a virtual or abstract method from its base class. Syntax Following is the syntax for declaring a sealed method − public sealed override ReturnType MethodName() { // method implementation } Key Rules for Sealed Methods A sealed method must be an override of a virtual or abstract method. Once ...

Read More

What are static or fixed length arrays in C#?

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

A static array or fixed-length array in C# is a data structure with a predetermined size that cannot be changed after creation. Once you declare an array with a specific length, that size remains constant throughout the program's execution. Static arrays are different from dynamic collections like List because their size is immutable. This makes them memory-efficient and provides predictable performance characteristics. Syntax Following is the syntax for declaring a static array − dataType[] arrayName = new dataType[size]; You can also initialize a static array with values at declaration − dataType[] ...

Read More

What is the octal equivalent of a decimal number in C#?

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

To get the octal equivalent of a decimal number in C#, you need to repeatedly divide the decimal number by 8 and store the remainders. The octal number system uses base 8 (digits 0-7), while decimal uses base 10. Syntax Following is the basic algorithm for decimal to octal conversion − while (decimal != 0) { remainder = decimal % 8; decimal = decimal / 8; // store remainder in array } How It Works The conversion process involves dividing the decimal number by ...

Read More

What is Type safe in C#?

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

Type safety in C# is a fundamental feature that prevents objects from accessing memory locations that don't belong to them. This means you cannot accidentally treat one object type as another incompatible type, which helps prevent runtime errors and memory corruption. The C# compiler enforces type safety at compile time, ensuring that operations are performed only on compatible types. This prevents common programming errors like accessing invalid memory locations or calling methods that don't exist on an object. How Type Safety Works C# prevents unsafe type conversions through compile-time checking. When you attempt to cast an object ...

Read More

What are the escape sequences supported by C#?

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

Escape sequences in C# are special character combinations that start with a backslash (\) and represent characters that are difficult or impossible to type directly. These sequences allow you to include special characters like newlines, tabs, quotes, and control characters in your strings. Syntax Following is the syntax for escape sequences in C# − string text = "HelloWorld"; // represents a newline char tab = '\t'; // \t represents a tab character Common Escape Sequences ...

Read More

What are the hidden features of C#?

Chandu yadav
Chandu yadav
Updated on 17-Mar-2026 460 Views

C# contains several powerful but often overlooked features that can significantly improve code readability, safety, and efficiency. These hidden gems can make your C# programming more elegant and productive when used appropriately. Lambda Expressions A lambda expression is a concise way to write anonymous functions using the => operator (called the "goes to" operator). Lambda expressions are commonly used with LINQ operations and delegate assignments. Syntax (parameters) => expression (parameters) => { statements; } Example using System; using System.Linq; class Program { public static void Main() ...

Read More
Showing 1011–1020 of 1,951 articles
« Prev 1 100 101 102 103 104 196 Next »
Advertisements