Csharp Articles

Page 76 of 196

Find the Angle Between Hour and Minute Hands of a Clock in C#

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 7K+ Views

The calculation of the angle between the hour and minute hands of a clock is a common problem in logical reasoning and programming. This calculation is used in various applications, such as analog clock simulations, scheduling software, and time-based animations. In this article, we will discuss how to calculate the angle between the hour and minute hands of a clock in C# using different approaches. What is the Angle Between the Hour and Minute Hands? The angle between the hour and minute hands is determined based on the positions of both hands on the clock face. Key ...

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 763 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

Common Language Runtime (CLR) in C#.NET

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

The Common Language Runtime (CLR) is the execution environment for .NET applications that manages code execution, memory allocation, and provides essential runtime services. It acts as an intermediary between your C# code and the operating system, converting intermediate language code into machine-specific instructions through just-in-time compilation. The CLR ensures that C# applications run safely and efficiently by providing automatic memory management, exception handling, type safety verification, and cross-language interoperability across all .NET languages. CLR Execution Process C# Code IL Code (Bytecode) ...

Read More

What are Left Shift and Right Shift Operators (>> and <<) in C#?

George John
George John
Updated on 17-Mar-2026 1K+ Views

The left shift () operators in C# are bitwise operators that shift the bits of a number left or right by a specified number of positions. These operators are commonly used for efficient multiplication and division by powers of 2, as well as for low-level bit manipulation. Syntax Following is the syntax for the left shift operator − result = operand > numberOfPositions; How Left Shift Works The left shift operator (> 3; /* Right shift by 3: 60 / 8 = 7 */ Console.WriteLine("60 >> 3 ...

Read More

Working with DateTime in C#

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

The DateTime class in C# is used to represent dates and times. It provides properties and methods to work with date and time values, perform calculations, comparisons, and formatting operations. Syntax Following is the syntax for creating DateTime objects − DateTime variableName = new DateTime(year, month, day); DateTime variableName = new DateTime(year, month, day, hour, minute, second); DateTime variableName = DateTime.Now; // current date and time DateTime variableName = DateTime.Today; // current date only Common DateTime Properties Property Description Date Gets the date component (time ...

Read More

Major features of C# programming

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

C# is a modern, general-purpose, object-oriented programming language developed by Microsoft. C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows the use of various high-level languages on different computer platforms and architectures. C# combines the power of C++ with the simplicity of Visual Basic, making it an ideal choice for developing a wide range of applications from web services to desktop applications. Key Features of C# Major C# Features Core Language ...

Read More
Showing 751–760 of 1,951 articles
« Prev 1 74 75 76 77 78 196 Next »
Advertisements