- 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 2745 Articles for Csharp
795 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
124 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
170 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
16K+ 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
149 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
4K+ 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
765 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
4K+ Views
C# is a powerful object-oriented programming language used for developing a wide range of applications. In this article, we will discuss how to write a C# program to read and write a byte array to a file using the FileStream class. Step 1: Creating a Byte Array The first step in this program is to create a byte array that we want to write to a file. Here is an example − byte[] byteArray = { 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64 }; Step 2: Writing Byte Array to File The next step is ... Read More
220 Views
Is operator also called as the type-compatibility operator plays an integral role in C# structures. Let’s try to understand this operator. C#’s Is operator checks if the given object is compatible with another object and gives the result as true, if it is compatible. Else returns false. Syntax expression is obj Example Expression is the object which you like to check compatibility with. The expression can include variables, literals and method calls. Obj is the type against which the expression is verified. This can comprise of built-in and user-defined types. // The operation of the type compatibility operator is ... Read More
1K+ Views
A BitArray is a collection of Boolean values represented as a series of 1’s and 0’s. It is often used to store and manipulate binary data efficiently. In C#, the BitArray class is part of the System. Collections namespace, and it allows you to manipulate the individual bits in the array using bitwise operators. Inverting all bit Values in a BitArray To invert all bit values in a BitArray in C#, you can use the exclusive OR (XOR) operator (^) with the number 1. This operator returns a value of 1 if the bits being compared are different and 0 ... Read More
To Continue Learning Please Login
Login with Google