- 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
Samual Sam has Published 2492 Articles
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
214 Views
Firstly, set two lists in C#.List OneList list1 = new List (); list1.Add("P"); list1.Add("Q"); list1.Add("R"); list1.Add("S"); list1.Add("T"); list1.Add("U"); list1.Add("V"); list1.Add("W");List TwoList list2 = new List (); list2.Add("T"); list2.Add("U"); list2.Add("V"); list2.Add("W");Now, to get the different values in both the lists, use the Except method. It returns the ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
2K+ Views
To validate, you need to check for the protocols.http httpsWith that, you need to check for .com, .in, .org, etc.For this, use the following regular expression −(http|http(s)?://)?([\w-]+\.)+[\w-]+[.com|.in|.org]+(\[\?%&=]*)?The following is the code −Example Live Demousing System; using System.Text.RegularExpressions; namespace RegExApplication { class Program { private static void showMatch(string ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
65 Views
Set the string.StringBuilder str = new StringBuilder("Tom Hanks");Now, use the replace() method to replace whitespace with String. Empty. This will eventually remove the whitespace.str.Replace(" ", String.Empty);Let us see the complete code −Example Live Demousing System; using System.Text; class Demo { static void Main() { StringBuilder str = ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
137 Views
With C#, you can manipulate decimals with operators such as _+, - *, etc.Let us see how to subtract decimal values.Firstly, set two decimal values −decimal d1 = 9.5M; decimal d2 = 4.2M;Now to subtract the two values −d1 = d1 - d2;The following is the code −Example Live Demousing System; ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
245 Views
Set a character with WhiteSpace −char c = ' ';To check if a character is a whitespace character, use the char.IsWhiteSpace method −if (char.IsWhiteSpace(c)) {}Let us see the complete code −Example Live Demousing System; class Demo { static void Main() { char c = ' '; ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
140 Views
The SequenceEqual method is used to test collections for equality.Set sequences −string[] arr1 = { "This", "is", "it" }; string[] arr2 = { "My", "work", "report" }; string[] arr3 = { "This", "is", "it" };Now, use the SequenceEquals methods to check whether sequences are same or not −arr1.SequenceEqual(arr2);The following is ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
118 Views
To convert a string to a bool, use the Bool.parse method in C# −Firstly, set a string −string str = "true";Now, convert it to bool −bool.Parse(str);Here is the complete code −Example Live Demousing System; using System.Linq; class Demo { static void Main() { string str = "true"; ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
4K+ Views
Use the Truncate method in C# to remove all the number after decimal places.Let’s say the following is our number −9.15MTo remove the numbers after decimal places, use Truncate() −decimal.Truncate(9.15M)Let us see the complete code −Example Live Demousing System; using System.Linq; class Demo { static void Main() { ... Read More
![Samual Sam](https://www.tutorialspoint.com/assets/profiles/13514/profile/60_83486-1512649303.jpg)
Samual Sam
2K+ Views
The decimal type is a value type and has the plus, minus, multiply and divide operators.Firstly, set two decimal values −decimal d1 = 5.8M; decimal d2 = 3.2M;To add decimals −d1 = d1 + d2;Let us see an example to add two decimal values −Example Live Demousing System; using System.Linq; class ... Read More