In this example, we’ll learn how to get HDD type using C#. C# Code: C# static void Main(string[] args) { System.IO.FileInfo file = new System.IO.FileInfo("E:\"); // File or Directory System.IO.DriveInfo _driveInfo = new...
Tag - C# Console Application Examples
as Operator in C# with Examples
In this tutorial,we’ll learn How to use ‘as’ operator in C#. The “as” operator perform conversions between compatible types. It is like a cast operation and it performs only reference conversions...
How to Find Sum of Digits of a Number Using Recursion in C#?
In this article, we will learnn how to find sum of digits of a number using Recursion. What is Recursion? The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is...
How to Check Password Validity in C#
In this article, we will write a C# program to check password. While creating a password, you may have seen the validation requirements on a website like a password should be strong and have − Min 8 char and max 14 charOne lower...
How to Count the Number of Words in a String in C#
In this example we’ll learn How to count the number of words in a string in C#. Let us see the complete code to count a number of words in a string in C#. C# using System; public class Demo { public static void Main() { int...
How to Check if a Substring is Present in a Given String in C#
C# program to check if a Substring is present in a Given String. Use the contains() method in C# to check if a substring is in a given string. Let us say the string is − United 123 United Within the string, you need...
How to Add and Concatenate Strings in C# with Examples
In this example, i’ll show you How to add and concatenate string in C#. Plus Operator C# string str2 = "csharp" + str1; 123 string str2 = "csharp" + str1; Example Let us see an example of + operator to...
Generate Pascals Triangle for the Given Number Using C#
In this example, i’ll show you, How to generate pascals triangle for the given number using C#. Pascal’s Triangle is a number pattern in the shape of a triangle. Pascal’s Triangle has many applications in mathematics and...
Return the First Unique Character Without Using Inbuilt Functions Using C#
In this example,i’ll show you How to return the first unique character without using inbuilt functions using C#. Create an empty new array of length 256, traverse through the entire string character by character and...
Find the Missing Number and the Repeated Number in a Sorted Array Without Using any Inbuilt Functions using C#
How to find the missing number and the repeated number in a sorted array without using any inbuilt functions using C#? To find the missing number Create a new array and traverse through the entire array and make the number true...