Articles on Trending Technologies

Technical articles with clear explanations and examples

Tuple Rest Property in C#

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

The Rest property in C# tuples allows you to create tuples with eight or more elements by nesting additional tuple objects. When a tuple has more than seven elements, the eighth and subsequent elements are stored in the Rest property as a nested tuple. Syntax The general structure for an 8-element tuple using the Rest property is − Tuple Where TRest is another tuple type containing the remaining elements. You can create such tuples using Tuple.Create() − var myTuple = Tuple.Create(item1, item2, item3, item4, item5, item6, item7, item8); How the ...

Read More

How to call Math Operations using Delegates in C#?

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

To understand how to call Math Operations using Delegates in C#, let us see an example wherein we will perform mathematical operations like division, multiplication, and addition using delegates. A delegate in C# is a type that represents references to methods with a specific signature. Syntax Following is the syntax for declaring a delegate that can reference mathematical methods − delegate returnType DelegateName(parameters); Following is the syntax for assigning methods to a delegate − DelegateName delegateInstance = MethodName; // or DelegateName delegateInstance = new DelegateName(MethodName); Using Delegates for Basic Math ...

Read More

How to calculate the power exponent value using C#?

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

To calculate the power exponent value in C#, use the Math.Pow() method from the System namespace. This method raises a number to a specified power and returns the result as a double. Syntax Following is the syntax for the Math.Pow() method − public static double Pow(double x, double y) Parameters x − The base number (of type double). y − The exponent (of type double). Return Value Returns a double value representing x raised to the power of y (xy). Using Math.Pow() with Integers ...

Read More

What is a managed code in C#?

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

Managed code in C# is code whose execution is managed by the Common Language Runtime (CLR). The CLR provides automatic memory management, type safety, exception handling, and garbage collection. When you write C# code, it gets compiled into Intermediate Language (IL) code, which is then executed by the CLR. Unlike unmanaged code (such as C/C++), managed code runs within the .NET runtime environment, which handles low-level operations automatically. This makes development safer and more efficient by reducing common programming errors like memory leaks and buffer overflows. How Managed Code Works The execution process of managed code follows ...

Read More

Inheritance vs Composition in C#

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

In C#, there are two fundamental ways to establish relationships between classes: inheritance and composition. Inheritance creates an "IS-A" relationship where a derived class inherits behavior from a base class, while composition creates a "HAS-A" relationship where one class contains instances of other classes as components. Inheritance Inheritance allows you to designate that a new class should inherit the members of an existing class. The existing class is called the base class, and the new class is referred to as the derived class. Inheritance implements the IS-A relationship. For example, mammal IS-A animal, dog IS-A mammal, hence dog ...

Read More

C# program to find additional values in two lists

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

Finding additional values between two lists is a common requirement in C# programming. This involves identifying elements that exist in one list but not in another. The Except() method from LINQ provides an efficient way to find the difference between two collections. Syntax The Except() method returns elements from the first sequence that are not present in the second sequence − IEnumerable result = list1.Except(list2); To find differences in both directions, you can use − var onlyInList1 = list1.Except(list2); var onlyInList2 = list2.Except(list1); Using Except() to Find Additional Values ...

Read More

Fibonacci Series in C#

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

The Fibonacci series is a sequence of numbers where each number is the sum of the two preceding numbers. The series typically starts with 0 and 1, producing the sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, and so on. In C#, there are multiple ways to generate the Fibonacci series, including iterative and recursive approaches. Fibonacci Series Pattern 0 1 1 2 3 ...

Read More

C# object serialization

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

Object serialization in C# is the process of converting an object into a stream of bytes for storage or transmission. The serialized data can be saved to files, databases, or sent over a network, and later deserialized back into objects. C# provides several approaches for serialization, including binary serialization, XML serialization, and JSON serialization. Binary serialization preserves the complete object state and type information. Syntax For binary serialization using BinaryFormatter − [Serializable] public class ClassName { // class members } BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, objectInstance); For deserialization ...

Read More

How to perform Division of Exponents of Same Base using C#?

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

When dividing exponents with the same base, we use the mathematical rule: a^m ÷ a^n = a^(m-n). This means we subtract the exponent in the denominator from the exponent in the numerator while keeping the base unchanged. In C#, we can implement this rule by subtracting the exponents and then using Math.Pow() to calculate the final result. Mathematical Rule The division rule for exponents with the same base is − a^m ÷ a^n = a^(m-n) For example: 10^10 ÷ 10^8 = 10^(10-8) = 10^2 = 100 Division of ...

Read More

Local Inner Class in C#

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

A nested class in C# is a class declared inside another enclosing class. The nested class is a member of its outer class and can access the outer class's private members, while the outer class cannot directly access the nested class's members without creating an instance. Nested classes provide better organization and encapsulation by grouping related functionality together. They are particularly useful when a class is only meaningful within the context of another class. Syntax Following is the syntax for declaring a nested class − class OuterClass { // outer class ...

Read More
Showing 11251–11260 of 61,297 articles
Advertisements