
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2587 Articles for Csharp

410 Views
In C#, LINQ (Language Integrated Query) is a powerful tool that enables you to easily sort, filter, and manipulate data. In this article, we'll demonstrate how to use LINQ to sort a list of employees based on their salary in descending order and department in which they work. Sorting a List of Employees Based on Salary in Descending Order and Whose Department is XYZ using LINQ − To sort a list of employees based on their salary in descending order and department using LINQ, you can follow the steps below − Create a class to represent an Employee − ... Read More

943 Views
In C#, LINQ (Language Integrated Query) is a powerful tool that enables you to easily sort, filter, and manipulate data. In this article, we'll demonstrate how to use LINQ to sort a list of employees based on their salary and department. Sorting a List of Employees Based on Salary and Department using LINQ To sort a list of employees based on their salary and department using LINQ, you can follow the steps below − 1. Create a Class to Represent an Employee public class Employee { public string Name { get; set; } public int ... Read More

8K+ Views
The GetEnvironmentVariable() method of the Environment class in C# is used to get the value of an environment variable. It is a useful method for retrieving system-wide and user-specific environment variables. In this article, we will discuss the usage of the GetEnvironmentVariable() method and see how to use it in a C# program. What is the GetEnvironmentVariable() Method? The GetEnvironmentVariable() method is a static method of the Environment class in C#. It takes the name of an environment variable as a string and returns the value of the variable as a string. If the environment variable does not exist, it ... Read More

2K+ Views
The Exists property in C# is a very useful property that checks whether any element in a collection matches a given condition. This property is a part of the List class in C# and returns a Boolean value indicating whether any element exists in the list that satisfies the specified condition. In this article, we will explore the usage of the Exists property in a C# program. What is the Exists Property? The Exists property is a Boolean property that is defined in the List class in C#. It takes a delegate as an argument and returns a Boolean value ... Read More

282 Views
The Aggregate() method is a powerful LINQ method that allows you to perform a reduction operation on a sequence of elements. This method can be used to perform calculations on a collection of data, such as finding the sum, product, or maximum value of a set of numbers. In this article, we will explore how to use the Aggregate() method in a C# program. What is the Aggregate() Method? The Aggregate() method is a LINQ extension method that takes two parameters: a seed value and a function that performs a reduction operation on a sequence of elements. The seed value ... Read More

513 Views
Searching for sub-directories in a given directory is a common task in many applications. In C#, we can use the Directory and DirectoryInfo classes provided by the System.IO namespace to perform this task. In this article, we will explore how to write a C# program to search for sub-directories in a given directory. Method: Using DirectoryInfo.GetDirectories() The simplest way to search for sub-directories in a given directory is by using the DirectoryInfo.GetDirectories() method. This method returns an array of DirectoryInfo objects that represent the directories within a specified directory. Here's how we can use the DirectoryInfo.GetDirectories() method to search for ... Read More

28K+ Views
Searching directories and listing files is a common task in many applications. In C#, we can use the Directory and File classes provided by the System.IO namespace to perform these tasks. In this article, we will explore how to write a C# program to search directories and list files. Method: Using Directory.GetFiles() The simplest way to search directories and list files in C# is by using the Directory.GetFiles() method. This method returns an array of strings that represents the paths of all files in a specified directory that match a specified search pattern. Here's how we can use the Directory.GetFiles() ... Read More

280 Views
In C#, LINQ (Language Integrated Query) is a powerful feature that allows us to perform queries on various data sources, including arrays, lists, and databases. It is an efficient and concise way to manipulate data and has become an essential tool for developers. In this article, we will explore how to use LINQ to reverse a list of cities in C#. Before we dive into the code, let us first understand what LINQ is. LINQ is a set of extensions to the .NET Framework that provides a standard way to query data from different data sources using a common syntax. ... Read More

8K+ Views
In programming, there are many situations where we need to reverse a string. One of the most common ways to do this is by using the Reverse() method. However, there are situations where we cannot use this method, and we have to reverse the string using other techniques. In this article, we will explore how to reverse a string in C# without using the Reverse() method. Before we dive into the code, let us first understand what a string is. A string is a sequence of characters that represents text. In C#, a string is a sequence of Unicode characters. ... Read More

1K+ Views
C# is a popular object-oriented programming language used to develop Windows applications, web applications, and games. In this article, we will discuss how to write a C# program to read a string and find the sum of all digits present in the string. Step 1: Reading the Input String The first step in this program is to read the input string from the user. We can use the Console.ReadLine() method to read the string from the console. Here is an example − Console.WriteLine("Enter a string:"); string inputString = Console.ReadLine(); Step 2: Finding the Sum of Digits The next step ... Read More