Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
Get the number of nodes contained in LinkedList in C#
In C#, the LinkedList class provides the Count property to get the number of nodes contained in the LinkedList. This property returns an integer representing the total number of elements in the collection. Syntax Following is the syntax to get the count of nodes in a LinkedList − int count = linkedList.Count; Return Value The Count property returns an int value representing the number of nodes currently present in the LinkedList. LinkedList Node Count Node A Node B ...
Read MoreReverse the order of the elements in the entire List or in the specified range in C#
The List.Reverse() method in C# allows you to reverse the order of elements in a List. You can reverse the entire list or reverse a specific range of elements within the list. Syntax Following is the syntax for reversing the entire list − list.Reverse(); Following is the syntax for reversing a specified range of elements − list.Reverse(int index, int count); Parameters index − The zero-based starting index of the range to reverse. count − The number of elements in the range to reverse. ...
Read MoreWhat is the difference between List and IList in C#?
The main difference between List and IList in C# is that List is a concrete class that implements the list functionality, while IList is an interface that defines the contract for list operations. The IList interface inherits from both ICollection and IEnumerable interfaces. List and IList both represent collections of objects that can be accessed by index. They provide methods to insert, remove, search, and sort elements. The key distinction is that List is a specific implementation while IList is a contract that multiple classes can implement. Key Differences List IList ...
Read MoreC# program to check if a matrix is symmetric
In this article, we are going to discuss how we can check if a matrix is symmetric or not using C#. What is a Symmetric Matrix? A symmetric matrix is a square matrix (matrix which has the same number of rows and columns) in which the element at position A[i][j] is equal to the element at A[j][i] for all i and j. In simple words, a matrix is called symmetric if it is equal to its transpose. Symmetric Matrix Property Original Matrix 1 2 3 ...
Read MoreUInt32.Equals() Method in C# with Examples
The UInt32.Equals() method in C# returns a value indicating whether this instance is equal to a specified object or UInt32. This method provides two overloads for comparing 32-bit unsigned integers with different parameter types. Syntax Following are the two overloads of the UInt32.Equals() method − public override bool Equals (object obj); public bool Equals (uint value); Parameters obj − An object to compare with this instance (first overload). value − A 32-bit unsigned integer to compare with this instance (second overload). Return Value Both methods ...
Read MoreBoolean.GetTypeCode() Method in C# with Examples
The Boolean.GetTypeCode() method in C# is used to return the type code for the Boolean value type. This method returns TypeCode.Boolean, which is part of the TypeCode enumeration that represents different data types in the .NET framework. Syntax Following is the syntax for the Boolean.GetTypeCode() method − public TypeCode GetTypeCode(); Return Value This method returns TypeCode.Boolean, which represents the Boolean data type in the TypeCode enumeration. Using GetTypeCode() with Boolean Values Example using System; public class Demo { public static void Main(String[] args) { ...
Read MoreWhat is an Optional parameter in C#?
By default, all parameters of a method are required. However, C# allows you to define optional parameters that do not force you to pass arguments at calling time. This means you can call a method without passing values for some parameters. Optional parameters contain default values in the function definition. If you do not pass an argument for an optional parameter at calling time, the default value is used automatically. There are different ways to make a parameter optional in C#. Syntax Following is the syntax for declaring optional parameters using default values − ...
Read MoreHow to download a file from a URL in C#?
A file can be downloaded from a URL using WebClient, which is available in the System.Net namespace. The WebClient class provides common methods for sending data to or receiving data from any local, intranet, or Internet resource identified by a URI. The WebClient class uses the WebRequest class internally to provide access to web resources. It offers a simple, high-level interface for downloading files without dealing with complex HTTP protocols directly. Syntax Following is the syntax for downloading a file using WebClient.DownloadFile method − WebClient client = new WebClient(); client.DownloadFile("sourceUrl", "destinationPath"); Parameters ...
Read MoreHow to change the WindowTop of the Console in C#?
The Console.WindowTop property in C# gets or sets the top position of the console window relative to the screen buffer. This property is useful when you need to programmatically control the console window's vertical position within the buffer area. Syntax Following is the syntax to get or set the WindowTop property − // Get the current WindowTop position int topPosition = Console.WindowTop; // Set the WindowTop position Console.WindowTop = value; Parameters The WindowTop property accepts an integer value representing the top row of the console window area within the screen buffer. The ...
Read MoreGetting an enumerator that iterates through HashSet in C#
A HashSet in C# is a collection that stores unique elements without duplicates. To iterate through a HashSet, you can use the GetEnumerator() method which returns an enumerator object, or use a foreach loop for simpler iteration. The HashSet.Enumerator provides manual control over iteration using MoveNext() and Current properties, while foreach handles enumeration automatically behind the scenes. Syntax Following is the syntax for getting an enumerator from a HashSet − HashSet.Enumerator enumerator = hashSet.GetEnumerator(); while (enumerator.MoveNext()) { T current = enumerator.Current; // use current element } ...
Read More