- 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
George John has Published 1167 Articles
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
1K+ Views
To format output in C#, let us see examples to format date and double type.Set formatted output for Double type.Example Live Demousing System; class Demo { public static void Main(String[] args) { Console.WriteLine("Three decimal places..."); Console.WriteLine(String.Format("{0:0.000}", 987.383)); Console.WriteLine(String.Format("{0:0.000}", 987.38)); ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
608 Views
To display multiple blank lines, we will take a while loop.Here, we are printing 10 blank lines using Console.WriteLine();while (a < 10) { Console.WriteLine(" "); a++; }The following is the complete code to display multiple blank lines −Exampleusing System; namespace Program { public class Demo { ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
4K+ Views
Firstly, set the string to be replaced.string str = "Demo text!";Now use the replace() method to replace the above string.string res = str.Replace("Demo ", "New ");The following is the complete code to replace a word in a string.Example Live Demousing System; public class Demo { public static void Main() { ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
483 Views
Keywords are reserved words predefined to the C# compiler. These keywords cannot be used as identifiers. However, if you want to use these keywords as identifiers, you may prefix the keyword with the @ character.The following are the two types of keywords in C#.Reserved KeywordsabstractasbaseBoolbreakbytecasecatchcharcheckedClassconstcontinuedecimaldefaultdelegatedoDoubleelseenumeventexplicitexternfalseFinallyfixedfloatforforeachgotoifImplicitinin (generic modifier)intinterfaceinternalisLocklongnamespacenewnullobjectoperatorOutout (generic modifier)overrideparamsprivateprotectedpublicReadonlyrefreturnsbytesealedshortsizeofstackallocstaticstringstructswitchthisthrowTruetrytypeofuintulonguncheckedunsafeUshortusingvirtualvoidvolatilewhileContextual Keywordsaddaliasascendingdescendingdynamicfromgetglobalgroupintojoinletorderbypartial ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
4K+ Views
Set maximum value for char.static int maxCHARS = 256;Now display the duplicate characters in the string.String s = "Welcometomywebsite!"; int []cal = new int[maxCHARS]; calculate(s, cal); for (int i = 0; i < maxCHARS; i++) if(cal[i] > 1) { Console.WriteLine("Character "+(char)i); Console.WriteLine("Occurrence = " + cal[i] ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
771 Views
To perform matrix addition, take two matrices. Enter the rows and columns of matrix one and matrix two. Remember, both the matrix should be a square matrix to add them.Now add elements to both the matrices. Declare a new array and add both the arrays in it.arr3[i, j] = arr1[i, ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
228 Views
To understand how to call Math Operations using Delegates in C#, let us see an example wherein we will divide a number.We have a class and a function in it −public class Demo { public static double DivideFunc(double value) { return value / 5; } ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
1K+ Views
Read()The Read() reads the next characters from the standard input stream. If a key is pressed on the console, then it would close.int az = Console.Read() Console.WriteLine(z);ReadKey()It reads only a single charactare from the standard input stream.ReadLine()Reads the next line of characters from the standard input stream.Example Live Demousing System; class ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
539 Views
Read()The Read() reads the next characters from the standard input stream. If a key is pressed on the console, then it would close.int a = Console.Read() Console.WriteLine(a);ReadLine()It reads the next line of characters from the standard input stream.Example Live Demousing System; class Program { static void Main() { ... Read More
![George John](https://www.tutorialspoint.com/assets/profiles/13511/profile/60_58410-1512537824.png)
George John
5K+ Views
The TrimEnd() method removes all trailing occurrences of a set of characters specified in an array.For example, the following string has trailing 1s.String str ="234561111".We can easily remove the above trailing 1s from a string using the TrimEnd() method.Let us see an example to remove all trailing 1s.Example Live Demousing System; ... Read More