Server Side Programming Articles

Page 751 of 2109

Creating an Index From the Specified Index at the Start of a Collection in C#

Siva Sai
Siva Sai
Updated on 17-Mar-2026 470 Views

In C#, manipulating collections is a frequent operation, with indexing being a crucial part of this process. The Index struct, introduced in C# 8.0, provides a powerful way to create indices that can represent positions from the start or end of a collection. This article will guide you through creating and using indices from specified positions at the start of collections in C#. Syntax Following is the syntax for creating an Index from the start of a collection − Index index = new Index(value, fromEnd: false); // OR using implicit conversion Index index = value; ...

Read More

Cross Join in LINQ

Siva Sai
Siva Sai
Updated on 17-Mar-2026 1K+ Views

Language Integrated Query (LINQ) is a powerful tool in C# for data manipulation, allowing for efficient and expressive data access and manipulation. One of the operations you can perform with LINQ is the cross join operation, which creates a Cartesian product between two data sources. Understanding Cross Join Cross join, also known as Cartesian product, is a type of join operation that matches each row of the first table with every row of the second table. If the first table has n rows and the second table has m rows, the result is a table with n×m rows. ...

Read More

Default Interface Methods in C#

Siva Sai
Siva Sai
Updated on 17-Mar-2026 698 Views

Default interface methods are a game-changing feature introduced in C# 8.0 that allow developers to add new methods to an interface without breaking existing implementations. This feature enables interface evolution while maintaining backward compatibility with existing code. Syntax Following is the syntax for defining a default interface method − public interface IInterfaceName { void MethodName() { // default implementation } } A class can use the default implementation or override it − public class ClassName : IInterfaceName { ...

Read More

Checking if Two ValueTuple T1 are Equal or Not in C#

Siva Sai
Siva Sai
Updated on 17-Mar-2026 318 Views

ValueTuple in C# is a structure used to represent a data structure that can hold more than one value of differing types. Introduced in C# 7.0, ValueTuples are a significant improvement over classic tuples as they provide semantic names to the fields and better performance. This article demonstrates how to compare two instances of ValueTuple to check if they are equal. Understanding ValueTuple in C# ValueTuple is a value type representation of the Tuple class. Unlike reference-type Tuples, ValueTuples are stored on the stack and allow you to create tuples with named fields, making your code more readable ...

Read More

How to get only Date portion from DateTime object in C#?

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

There are several ways to extract only the date portion from a DateTime object in C#. Each method serves different purposes depending on whether you need a string representation or want to preserve the DateTime type. Methods Overview Method Return Type Description ToShortDateString() String Returns culture-specific short date format ToLongDateString() String Returns culture-specific long date format ToString(format) String Returns custom formatted date string DateTime.Date DateTime Returns DateTime with time set to 00:00:00 Using ToShortDateString() and ToLongDateString() These methods provide culture-specific ...

Read More

Association, Composition and Aggregation in C#

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

In C#, object-oriented programming relies on relationships between classes to model real-world scenarios. Three fundamental types of relationships are Association, Composition, and Aggregation. These relationships define how objects interact and depend on each other. Object Relationships in C# Association "Uses-a" Loose coupling Aggregation "Has-a" Weak ownership Composition "Part-of" Strong ownership ...

Read More

Background Worker Class in C#

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

The BackgroundWorker class in C# allows you to run long-running operations on a separate thread while keeping the user interface responsive. It provides a simple way to execute tasks in the background and communicate with the main thread for progress updates and completion notifications. BackgroundWorker is particularly useful in Windows Forms applications where intensive tasks need to run without freezing the UI. It handles thread management automatically and provides events for progress reporting and task completion. Key Properties Property Description CancellationPending Indicates whether the application has requested cancellation of the ...

Read More

Basic calculator program using C#

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

A calculator program in C# can be built using either Windows Forms or Console applications. This tutorial demonstrates how to create a basic calculator that performs fundamental arithmetic operations like addition, subtraction, multiplication, and division. We'll create a complete console-based calculator that takes user input and performs calculations, making it easy to understand the core logic before moving to GUI implementations. Console-Based Calculator Basic Calculator with Menu using System; class Calculator { public static void Main(string[] args) { double num1, num2, result; ...

Read More

C# and Multiple Inheritance

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

C# does not support multiple inheritance of classes, meaning a class cannot inherit from more than one base class directly. However, C# provides interfaces to achieve similar functionality to multiple inheritance by allowing a class to implement multiple interfaces. Multiple inheritance allows a class to inherit features from multiple parent classes. While this can be powerful, it can also lead to complexity and ambiguity, which is why C# chose to support only single inheritance of classes. Why Multiple Inheritance is Not Supported C# avoids multiple class inheritance to prevent the diamond problem, where ambiguity arises when two ...

Read More

C# program to check if two matrices are identical

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

In C#, to check whether two matrices are identical, you need to compare their dimensions first and then their corresponding elements. Two matrices are considered identical if they have the same dimensions and all corresponding elements are equal. Algorithm The algorithm for checking matrix equality involves the following steps − Compare the dimensions (rows and columns) of both matrices If dimensions don't match, the matrices cannot be identical If dimensions match, compare each corresponding element Use a flag to track if all elements are equal Matrix Comparison Process ...

Read More
Showing 7501–7510 of 21,090 articles
« Prev 1 749 750 751 752 753 2109 Next »
Advertisements