Programming Articles

Page 883 of 2547

C# program to add two matrices

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

Matrix addition is a fundamental operation in linear algebra where two matrices of the same dimensions are added element by element. In C#, we can implement matrix addition using two-dimensional arrays. Syntax To declare a two-dimensional array for matrix operations − int[, ] matrix = new int[rows, columns]; Matrix addition formula for each element − result[i, j] = matrix1[i, j] + matrix2[i, j]; How Matrix Addition Works Matrix addition requires both matrices to have the same dimensions. Each element at position (i, j) in the first matrix is added ...

Read More

Decimal.ToSByte() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 99 Views

The Decimal.ToSByte() method in C# converts a decimal value to an equivalent 8-bit signed integer (sbyte). This method performs truncation, discarding any fractional part and returning only the integer portion of the decimal value. The sbyte data type can hold values from -128 to 127. If the decimal value is outside this range, an OverflowException will be thrown. Syntax Following is the syntax − public static sbyte ToSByte(decimal val); Parameters val − The decimal number to convert to an sbyte. Return Value Returns an sbyte value ...

Read More

Access Modifiers in C#

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

Access modifiers in C# control the visibility and accessibility of classes, methods, properties, and other members. They define which parts of your code can access specific members, providing encapsulation and security to your applications. Access Modifiers Overview C# provides five access modifiers that determine the scope and accessibility of class members − C# Access Modifiers Hierarchy public Most accessible protected internal internal protected private ...

Read More

A Deque Class in C#

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

A Deque (double-ended queue) is a data structure that allows insertion and deletion of elements from both ends. In C#, while there's no built-in Deque class, we can implement one using a doubly-linked list or utilize existing collections like LinkedList to achieve deque functionality. The key advantage of a deque is its flexibility — you can add and remove elements from both the front and back, making it suitable for scenarios like implementing sliding window algorithms, browser history, or undo/redo operations. Deque Operations A typical deque supports the following core operations − AddFirst() — adds ...

Read More

Beginning C# programming with Hello World

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

The following is a simple "Hello World" program in C# programming. This is typically the first program you write when learning a new language, and it demonstrates the basic structure of a C# application. Syntax Following is the basic structure of a C# program − using System; namespace NamespaceName { class ClassName { static void Main(string[] args) { // Your code here } } } Hello ...

Read More

Abstract Classes in C#

karthikeya Boyini
karthikeya Boyini
Updated on 16-Mar-2026 3K+ Views

An abstract class in C# includes both abstract and non-abstract methods. A class is declared abstract using the abstract keyword. You cannot instantiate an abstract class directly — it must be inherited by a derived class that provides implementations for all abstract methods. Syntax Following is the syntax for declaring an abstract class and an abstract method − public abstract class ClassName { // Abstract method — no body, must be overridden public abstract void MethodName(); // Non-abstract method — has a body, can be inherited ...

Read More

'this' keyword in C#

karthikeya Boyini
karthikeya Boyini
Updated on 16-Mar-2026 10K+ Views

The this keyword in C# is used to refer to the current instance of the class. It is also used to differentiate between method parameters and class fields when they have the same name. Another usage of the this keyword is to call another constructor from a constructor in the same class, known as constructor chaining. Syntax Following is the syntax for using this to refer to instance members − this.fieldName = value; Following is the syntax for constructor chaining using this − public ClassName(int a) : this(a, 0) { ...

Read More

Revolutionize the TCL Scripting Skills: Master Arithmetic Operations with the Switch Statement!

sudhir sharma
sudhir sharma
Updated on 16-Mar-2026 414 Views

TCL (Tool Command Language) is a powerful scripting language widely used in network automation, testing, and system administration. One of its most useful control structures is the switch statement, which provides an elegant way to handle multiple conditional branches when performing arithmetic operations. This article explores how to effectively use switch statements in TCL scripts to perform basic arithmetic operations like addition, subtraction, multiplication, and division with clean, maintainable code. Understanding Switch Statements in TCL Switch statements in TCL provide a cleaner alternative to multiple if-else constructs. They test a given variable against multiple values and execute ...

Read More

Difference Between CORBA and RMI

Md. Sajid
Md. Sajid
Updated on 16-Mar-2026 3K+ Views

CORBA (Common Object Request Broker Architecture) and RMI (Remote Method Invocation) are middleware technologies used for distributed computing, enabling objects to communicate across networked environments. While both facilitate remote object communication, they differ significantly in their approach, language support, and architectural complexity. CORBA is a language-independent specification that allows objects written in different programming languages to communicate, while RMI is Java-specific technology for remote method calls between Java objects running on different JVMs. What is CORBA? CORBA (Common Object Request Broker Architecture) is a middleware specification that enables distributed objects in networked environments to communicate regardless of ...

Read More

Say Goodbye to Buffering: Learn How to Use Python\'s Stop & Wait and CRC in One Fell Swoop!

sudhir sharma
sudhir sharma
Updated on 16-Mar-2026 611 Views

In today's fast-paced digital world, ensuring reliable and error-free data transmission is crucial for efficient communication between devices. The Stop & Wait algorithm combined with Cyclic Redundancy Check (CRC) provides a robust solution for detecting errors and ensuring data integrity during transmission. This article explores how to implement these fundamental networking protocols in Python to achieve reliable data transfer with improved error detection capabilities. Understanding Stop & Wait Protocol and CRC The Stop & Wait protocol is a flow control mechanism where the sender transmits one data packet at a time and waits for an acknowledgment (ACK) ...

Read More
Showing 8821–8830 of 25,466 articles
« Prev 1 881 882 883 884 885 2547 Next »
Advertisements