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
Csharp Articles
Page 83 of 196
Medium-Earth Orbit Satellites
This article appears to be about satellite orbits, not C# programming. As a C# tutorial enhancement specialist, I can only improve C# programming articles for TutorialsPoint.com. Please provide a C# programming article that needs improvement, such as topics related to: C# language features (classes, methods, properties, etc.) .NET Framework concepts Object-oriented programming in C# C# syntax and programming constructs C# libraries and APIs I'll be happy to enhance any C# programming tutorial following the TutorialsPoint standards with proper code formatting, examples, and structure.
Read MoreC# program to check password validity
While creating a password, you may have seen validation requirements on websites that ensure a password is strong and secure. Common password requirements include − Minimum 8 characters and maximum 14 characters At least one lowercase letter No whitespace characters At least one uppercase letter At least one special character Let us create a complete password validation program that checks all these conditions systematically. Complete Password Validation Program using System; using System.Linq; class PasswordValidator { public static bool IsValidPassword(string passwd) { ...
Read MoreC# Program to Check Whether the Entered Number is an Armstrong Number or Not
An Armstrong number (also called a narcissistic number) is a number that equals the sum of its digits raised to the power of the number of digits. For a 3-digit number, each digit is cubed and summed. For example, 153 is an Armstrong number because − 1³ + 5³ + 3³ = 1 + 125 + 27 = 153 Armstrong Number Check Process 153 Original Number 1³ + 5³ + 3³ Sum of Cubes ...
Read MoreC# program to convert a list of characters into a string
Converting a list of characters into a string is a common operation in C#. There are several approaches to accomplish this task, each suitable for different scenarios and data structures. Syntax Following are the main syntax patterns for converting characters to strings − // Using string constructor with char array string result = new string(charArray); // Using string.Join() method string result = string.Join("", charList); // Using StringBuilder class StringBuilder sb = new StringBuilder(); sb.Append(charArray); string result = sb.ToString(); Using String Constructor with Character Array The most direct approach is using the ...
Read MoreC# program to iterate over a string array with for loop
A string array in C# can be iterated using a for loop to access each element by its index. The loop runs from index 0 to the length of the array minus one, allowing you to process each string element sequentially. Syntax Following is the syntax for iterating over a string array with a for loop − for (int i = 0; i < arrayName.Length; i++) { // Access element: arrayName[i] } The Length property returns the total number of elements in the array, and the loop variable i serves ...
Read MoreC# program to count the number of words in a string
In C#, counting the number of words in a string can be accomplished using various approaches. The most common method involves iterating through each character and identifying word separators like spaces, tabs, and newlines. Using Character-by-Character Iteration This approach loops through the string and counts whitespace characters to determine word boundaries − using System; public class Demo { public static void Main() { int a = 0, myWord = 1; string str = "Hello World!"; if (str.Length == 0) { myWord = 0; } else { while (a
Read MoreC# program to display the previous day
To display the previous day in C#, use the AddDays() method with a value of -1. This method allows you to add or subtract days from a DateTime object. Syntax Following is the syntax for getting the current date − DateTime.Today Following is the syntax for getting the previous day using AddDays() − DateTime.Today.AddDays(-1) Using DateTime.Today.AddDays(-1) The DateTime.Today property returns the current date with the time set to midnight. The AddDays(-1) method subtracts one day from this date − using System; public class Demo { ...
Read MoreC# program to count occurrences of a word in string
Counting occurrences of a specific word in a string is a common string manipulation task in C#. This can be achieved using various approaches like the IndexOf() method, regular expressions, or LINQ methods. Using IndexOf() Method The IndexOf() method searches for the first occurrence of a substring and returns its position. By combining it with a loop, we can count all occurrences − using System; class Program { static void Main() { string str = "Hello World! Hello Universe! Hello!"; ...
Read MoreC# program to convert binary string to Integer
Converting a binary string to an integer in C# can be accomplished using several methods. The most straightforward approach is using Convert.ToInt32() with base 2, but you can also implement manual conversion for better understanding of the binary-to-decimal process. Using Convert.ToInt32() Method The simplest way to convert a binary string to an integer is using the built-in Convert.ToInt32() method with base 2 − using System; class Program { static void Main() { string binaryStr = "1001"; ...
Read MoreC# Program to find the largest element from an array
Finding the largest element in an array is a common programming task in C#. There are multiple approaches to achieve this, ranging from using built-in LINQ methods to implementing custom logic with loops. Using LINQ Max() Method The simplest approach is to use the Max() method from the System.Linq namespace − using System; using System.Linq; class Demo { static void Main() { int[] arr = { 20, 50, -35, 25, 60 }; int largest = ...
Read More