- 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
Arjun Thakur has Published 1109 Articles
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
4K+ Views
Firstly, set a tuplevar tuple = Tuple.Create(100, 200, 300);Now, pass the tuple as a method parameter −Show(tuple);Here’s our method.static void Show(Tuple tuple)Now call the tuple values one by one as shown below −Example Live Demousing System; public class Program { public static void Main() { var tuple ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
175 Views
Use the Convert.ToUInt16 method to convert a specified value to a 16-bit unsigned integer.Here is our string −string str = "1129";Now let us convert it to 16-bit unsigned integer.ushort res; res = Convert.ToUInt16(str);The following is the complete example −Example Live Demousing System; public class Demo { public static void Main() ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
2K+ Views
The All Method checks for all the values in a collection and returns a Boolean. Even if one of the element do not satisfy the set condition, the All() method returns False.Let us see an example −int[] arr = {10, 15, 20};Now, using All() method, we will check whether each ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
500 Views
Firstly, set a string.StringBuilder str = new StringBuilder();Use Random.Random random = new Random((int)DateTime.Now.Ticks);Now loop through a number which is the length of the random string you want.for (int i = 0; i < 4; i++) { c = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))); str.Append(c); }On every iteration above, ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
566 Views
Use operator + to concatenate two or more string objects.Set the first string object.char[] c1 = { 'H', 'e', 'n', 'r', 'y' }; string str1 = new string(c1);Now, set the second string object.char[] c2 = { 'J', 'a', 'c', 'k' }; string str2 = new string(c2);Now display the concatenated strings ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
230 Views
To handle file paths, the Path class is used in C#.Set the file name in a string −string myPath = "D:ew\quiz.txt";Now, to get the extension, use the GetExtension() method −Path.GetExtension(myPath)Here is the complete code −Example Live Demousing System; using System.IO; namespace Demo { class Program { static ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
1K+ Views
The Enviornment.NewLine in C# is used to add newline.To set a new line in between words −str = "This is demo text!" + Environment.NewLine + "This is demo text on next line!";The following is the code −Example Live Demousing System; using System.IO; namespace Demo { class Program { ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
1K+ Views
To randomize string, firstly use Random class −Random r = new Random();Now, use the Next() method with OrderBy() −string random = new string(str.ToCharArray().OrderBy(s => (r.Next(2) % 2) == 0).ToArray());Here is the compete code that displays randomize string −Example Live Demousing System; using System.IO; using System.Linq; class Demo { static void ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
2K+ Views
Set a string −string str = "Bit and Bat";Let’s say you need to replace whatever comes inside B and t to A and capitalize the complete string. For that, use Replace −Regex.Replace(str, "B.t", "BAT");Let us see the complete code −Example Live Demousing System; using System.Text.RegularExpressions; namespace Demo { class Program ... Read More
![Arjun Thakur](https://www.tutorialspoint.com/assets/profiles/13574/profile/60_74441-1560315595.jpg)
Arjun Thakur
640 Views
Set a string array and convert it to character array −string str = "Amit"; char[] arr = str.ToCharArray();Now, use the Reverse method to display the above string in reverse alphabetic order −Array.Reverse(arr);Here is the complete code −Example Live Demousing System; using System.Linq; using System.IO; class Program { static void Main() ... Read More