Articles on Trending Technologies

Technical articles with clear explanations and examples

C# program to check if two matrices are identical

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 764 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

C# Program to get the name of the drive

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

The DriveInfo class in C# provides information about drives on the system. You can use the Name property to get the name of a specific drive by passing the drive letter to the DriveInfo constructor. Syntax Following is the syntax for creating a DriveInfo object and getting the drive name − DriveInfo info = new DriveInfo("driveLetter"); string driveName = info.Name; Parameters driveLetter − A string representing the drive letter (e.g., "C", "D", "E"). Return Value The Name property returns a string containing the name of the drive, ...

Read More

DateTime.AddMilliseconds() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 2K+ Views

The DateTime.AddMilliseconds() method in C# is used to add a specified number of milliseconds to a DateTime instance. This method returns a new DateTime object with the updated value, leaving the original DateTime unchanged. Syntax Following is the syntax − public DateTime AddMilliseconds(double value); Parameters value − A double representing the number of milliseconds to add. Can be positive or negative. Return Value Returns a new DateTime object whose value is the sum of the date and time represented by this instance and the number of milliseconds ...

Read More

What are reference data types in C#?

Chandu yadav
Chandu yadav
Updated on 17-Mar-2026 2K+ Views

The reference data types in C# do not store the actual data directly in a variable, but instead contain a reference (or pointer) to the memory location where the data is stored. When you assign a reference type variable to another variable, both variables point to the same object in memory. In C#, the following are the built-in reference types − Object Type The object type is the ultimate base class for all data types in C# Common Type System (CTS). Object variables can be assigned values of any other types, whether value types, reference types, predefined, ...

Read More

C# Program to get the name of root directory

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

Use the RootDirectory property to get the name of the root directory of a drive in C#. This property belongs to the DriveInfo class and returns a DirectoryInfo object representing the root directory. Syntax Following is the syntax for getting the root directory − DriveInfo driveInfo = new DriveInfo("driveLetter"); DirectoryInfo rootDir = driveInfo.RootDirectory; Using DriveInfo.RootDirectory Property First, create a DriveInfo object to specify the drive for which you want the root directory − DriveInfo dInfo = new DriveInfo("C"); Then, the RootDirectory property gives you the root directory − ...

Read More

C# Program to find the cube of elements in a list

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

This program demonstrates how to find the cube of each element in a list using the Select() method with a lambda expression. The Select() method transforms each element in the collection by applying a specified function. Syntax Following is the syntax for using Select() method with lambda expression − collection.Select(x => expression) For calculating the cube of each element − list.Select(x => x * x * x) Using Select() Method to Calculate Cube The Select() method applies a transformation function to each element in the list. In this case, ...

Read More

DateTime.AddMinutes() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 7K+ Views

The DateTime.AddMinutes() method in C# is used to add the specified number of minutes to the value of a DateTime instance. It returns a new DateTime object representing the calculated time without modifying the original instance. Syntax Following is the syntax − public DateTime AddMinutes(double minutes); Parameters minutes − A double value representing the number of minutes to add. The value can be positive (to add minutes) or negative (to subtract minutes). Fractional values are allowed. Return Value Returns a new DateTime object whose value is the sum of the date ...

Read More

C# Example for Single Inheritance

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

Single inheritance in C# allows a derived class to inherit from only one base class. This is the most common form of inheritance where a child class extends the functionality of its parent class by inheriting all accessible members and adding its own specific methods or properties. Syntax Following is the syntax for single inheritance in C# − class BaseClass { // base class members } class DerivedClass : BaseClass { // derived class members // inherits all accessible members from BaseClass } ...

Read More

Where do we use scope Resolution Operator (::) in C#?

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 856 Views

The scope resolution operator (::) in C# is used to access types within namespaces, especially when dealing with namespace aliases or when there are naming conflicts. Unlike C++ where it's primarily used for global variables, in C# it specifically relates to namespace resolution. The scope resolution operator helps distinguish between types that share the same name but exist in different namespaces. It's particularly useful when using namespace aliases or the global keyword. Syntax Following is the syntax for using the scope resolution operator with namespace aliases − alias::TypeName Following is the syntax for ...

Read More

Get the drive format in C#

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

The DriveFormat property in C# is used to get the file system format of a drive. It returns a string representing the format type such as NTFS, FAT32, or exFAT for Windows systems. Syntax Following is the syntax for using the DriveFormat property − DriveInfo driveInfo = new DriveInfo(driveLetter); string format = driveInfo.DriveFormat; Parameters driveLetter − A string representing the drive letter (e.g., "C", "D", "E"). Return Value The DriveFormat property returns a string containing the name of the file system, such as "NTFS", "FAT32", or "exFAT". ...

Read More
Showing 10901–10910 of 61,297 articles
Advertisements