- 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
Ankith Reddy has Published 1070 Articles
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
5K+ Views
To join two lists, use AddRange() method.Set the first list −var list1 = new List < string > (); list1.Add("Keyboard"); list1.Add("Mouse");Set the second list −var list2 = new List < string > (); list2.Add("Hard Disk"); list2.Add("Pen Drive");To concatenate both the lists −lists1.AddRange(lists2);The following is the complete code −Exampleusing System.Collections.Generic; using ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
334 Views
Let’s say we need to find that the following string is Palindrome or not −str = "Level";For that, convert the string into character array to chec each character −char[] ch = str.ToCharArray();Now find the reverse −Array.Reverse(ch);Use the Equals method to find whether the reverse is equal to original array or ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
209 Views
Use the ArrayList.Synchronized Method in C# for synchronization of ArrayList in C#.Let us see an example to lock the collection using SyncRoot property in C# −ArrayList arr = new ArrayList(); lock(arr.SyncRoot) { foreach (object ele in arr) { } }The following is the complete example to check the ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
916 Views
Firstly, set an array −int[] arr = { 87, 55, 23, 87, 45, 23, 98 };Now declare a dictionary and loop through the array and get the count of all the elements. The value you get from the dictionary displays the occurrence of ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
943 Views
Firstly, create an instance of DriveInfo −DriveInfo dInfo = new DriveInfo("E");Display free space −Console.WriteLine("Disk Free space = {0}", dInfo.AvailableFreeSpace); Now, use AvailableFreeSpace property and get the percentage of free space −Double pc = (dInfo.AvailableFreeSpace / (float)dInfo.TotalSize) * 100;Here, you will get the percentage of free size in comparison with the ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
254 Views
Firstly, set a jagged array.int[][] arr = new int[][] { new int[] { 0, 0 }, new int[] { 1, 2 }, new int[] { 2, 4 ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
8K+ Views
In C#, use readonly to declare a const array.public static readonly string[] a = { "Car", "Motorbike", "Cab" };In readonly, you can set the value at runtime as well unlike const.Another alternative of achieving what we saw above −public ReadOnlyCollection a { get { return new List { "Car", "Motorbike", ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
939 Views
Use the Replace() method to replace a character with asterisks.Let’s say our string is −string str = "dem* text";To replace it, use the Replace() method −str.Replace('*', 'o');Here is the complete code −Example Live Demousing System; public class Program { public static void Main() { string str = ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
961 Views
Firstly, declare and initialize a jagged array.int[][] arr = new int[][] { new int[] { 0, 0 }, new int[] { 1, 2 }, new int[] { 2, 4 }, new int[] { 3, 6 }, new int[] { 4, ... Read More
![Ankith Reddy](https://www.tutorialspoint.com/assets/profiles/22328/profile/60_142162-1519038074.jpg)
Ankith Reddy
3K+ Views
Set a stack and add elements to it.Stack st = new Stack(); st.Push('P'); st.Push('Q'); st.Push('R');Now set another stack to reverse it.Stack rev = new Stack();Until the count of ths Stack is not equal to 0, use the Push and Pop method to reverse it.while (st.Count != 0) { rev.Push(st.Pop()); ... Read More