Articles on Trending Technologies

Technical articles with clear explanations and examples

What is finally statement in C#?

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

The finally statement in C# is used to execute a given set of statements, whether an exception is thrown or not thrown. For example, if you open a file, it must be closed whether an exception is raised or not. The error handling blocks are implemented using the try, catch, and finally keywords. The finally block is guaranteed to execute, making it ideal for cleanup operations like closing files, database connections, or releasing resources. Syntax Following is the syntax for the finally statement − try { // code that might throw an ...

Read More

Convert.ToUInt64 Method in C#

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

The Convert.ToUInt64() method in C# converts a specified value to a 64-bit unsigned integer (ulong). This method accepts various data types and returns their equivalent ulong representation. Syntax Following is the syntax for the Convert.ToUInt64() method − public static ulong ToUInt64(object value) public static ulong ToUInt64(string value) public static ulong ToUInt64(char value) public static ulong ToUInt64(int value) public static ulong ToUInt64(double value) Parameters value − The value to convert. Can be of type object, string, char, numeric types, or other convertible types. Return Value Returns a 64-bit ...

Read More

What does Array.IsFixedSize property of array class do in C# ?

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

The IsFixedSize property of the ArrayList class is used to determine whether an ArrayList has a fixed size. When IsFixedSize returns true, you cannot add or remove elements, but you can still modify existing elements. When it returns false, the ArrayList can grow or shrink dynamically. Regular ArrayLists created with the default constructor always return false for IsFixedSize because they can dynamically resize. However, you can create fixed-size wrappers using ArrayList.FixedSize() method. Syntax Following is the syntax to check the IsFixedSize property − bool isFixed = arrayList.IsFixedSize; Following is the syntax to create ...

Read More

C# Linq Last() Method

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

The LINQ Last() method in C# returns the last element from a sequence. It throws an exception if the sequence is empty, making it suitable when you are certain the collection contains elements. Syntax Following is the syntax for the Last() method − public static TSource Last(this IEnumerable source); public static TSource Last(this IEnumerable source, Func predicate); Parameters source − The sequence to return the last element from. predicate − (Optional) A function to test each element for a condition. Return Value Returns the last ...

Read More

Class and Static Variables in C#

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

In C#, static variables belong to the class itself rather than to any specific instance of the class. They are shared among all instances of the class and can be accessed using the class name without creating an object. Class variables (instance variables) belong to individual objects and each instance has its own copy of these variables. Static Variables Static variables are declared using the static keyword and are useful for defining constants or shared data across all instances of a class. Syntax public static dataType variableName; Static vs ...

Read More

C# Program to create a Simple Thread

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

In C#, a thread represents a separate execution path that can run concurrently with other threads. The System.Threading.Thread class allows you to create and manage threads in your application. To create a simple thread, you define a method that contains the code you want to execute, then create a Thread object using a ThreadStart delegate that points to your method. Syntax Following is the syntax for creating a thread − Thread threadName = new Thread(new ThreadStart(methodName)); threadName.Start(); You can also use the simplified syntax − Thread threadName = new Thread(methodName); threadName.Start(); ...

Read More

C# Enum Equals Method

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

The Equals() method in C# is used to compare enum values for equality. It returns true if both enum values have the same underlying value, and false otherwise. Syntax Following is the syntax for using the Equals() method with enums − enumValue1.Equals(enumValue2) Parameters enumValue2 − The enum value to compare with the current enum value Return Value The method returns a bool value − true if both enum values are equal false if the enum values are different ...

Read More

C# Program to Create a Thread Pool

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 745 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 provides methods to queue work items for execution by available threads in the pool. This approach is particularly useful for short-running tasks that don't require dedicated threads. Syntax Following is the syntax for queueing a method for execution in the thread pool − ThreadPool.QueueUserWorkItem(new WaitCallback(methodName)); ...

Read More

What is overloading in C#?

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

C# provides two techniques to implement static polymorphism − Function overloading Operator overloading Function Overloading Function overloading in C# allows multiple methods with the same name but different parameters within the same class. The compiler determines which method to call based on the number, types, and order of arguments passed. Syntax Following is the syntax for function overloading − public returnType MethodName(parameter1) { } public returnType MethodName(parameter1, parameter2) { } public returnType MethodName(differentType parameter) { } Method Overloading Resolution Add(int, ...

Read More

What is a sealed class in C#?

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

A sealed class in C# is a class that cannot be inherited by other classes. When you declare a class as sealed, it prevents any other class from deriving from it. The sealed keyword can also be applied to methods to prevent them from being overridden in further derived classes. Sealed classes are useful when you want to restrict inheritance for security, performance, or design reasons. Common examples include the string class and many value types in .NET Framework. Syntax Following is the syntax for declaring a sealed class − public sealed class ClassName { ...

Read More
Showing 11221–11230 of 61,297 articles
Advertisements