- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 2724 Articles for Csharp
Updated on 04-May-2023 14:10:54
Sorting a list of string names is a common task in programming, and the LINQ OrderBy() method in C# provides an easy and efficient way to do so. In this article, we will walk you through a C# program to sort a list of string names using the LINQ OrderBy() method. What is LINQ OrderBy() Method? The LINQ OrderBy() method is used to sort the elements of a sequence in ascending or descending order based on one or more keys. The keys can be simple properties or complex expressions that return a value based on one or more properties of ... Read More
Updated on 04-May-2023 14:09:52
Sorting a list of integers is a common task in programming, and the LINQ OrderBy() method in C# provides an easy and efficient way to do so. In this article, we'll walk you through a C# program to sort a list of integers using the LINQ OrderBy() method. What is LINQ OrderBy() Method? The LINQ OrderBy() method is used to sort the elements of a sequence in ascending or descending order based on one or more keys. The keys can be simple properties or complex expressions that return a value based on one or more properties of the objects in ... Read More
Updated on 04-May-2023 14:08:34
In many software development projects, there comes a point where it becomes necessary to sort a list of objects based on one or more properties of the objects. In C#, the LINQ (Language Integrated Query) library provides a powerful and easy-to-use way to sort lists of objects based on one or more criteria. In this tutorial, we will demonstrate how to sort a list of Employee objects based on their salary using LINQ. Steps Create an Employee class with properties for Name, Salary, and Department. Create a List of Employee objects and populate it with some data. Use LINQ ... Read More
Updated on 04-May-2023 14:06:29
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
Updated on 04-May-2023 14:04:27
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
Updated on 04-May-2023 13:57:23
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
Updated on 04-May-2023 13:55:25
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
Updated on 04-May-2023 13:54:03
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
Updated on 04-May-2023 13:52:41
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
Updated on 04-May-2023 13:51:28
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 Advertisements