- 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
Found 2628 Articles for Csharp
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
63 Views
To remove the specified element from the list, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(String[] args) { List list1 = new List(); list1.Add("One"); list1.Add("Two"); list1.Add("Three"); list1.Add("Four"); list1.Add("Five"); Console.WriteLine("Elements in List1..."); foreach (string res in list1) { Console.WriteLine(res); } List list2 = new List(); list2.Add("India"); list2.Add("US"); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
268 Views
To remove the first occurrence of a specific object from the ArrayList, the code is as follows −Exampleusing System; using System.Collections; public class Demo { public static void Main(String[] args) { ArrayList list1 = new ArrayList(); list1.Add("A"); list1.Add("B"); list1.Add("C"); list1.Add("D"); list1.Add("E"); list1.Add("F"); list1.Add("G"); list1.Add("H"); list1.Add("I"); Console.WriteLine("Elements in ArrayList1..."); foreach (string res in list1) { Console.WriteLine(res); } ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
59 Views
To check if a SortedList is read-only, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(String[] args) { SortedList list = new SortedList(); list.Add("One", "IT"); list.Add("Two ", "Operations"); list.Add("Three", "Marketing"); list.Add("Four", "Purchase"); list.Add("Five", "Sales"); list.Add("Six", "Finance"); Console.WriteLine("SortedList elements..."); foreach(DictionaryEntry d in list) { Console.WriteLine(d.Key + " " + d.Value); } Console.WriteLine("List of values...SortedList"); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
49 Views
To get the keys in a SortedList object, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(String[] args) { SortedList list = new SortedList(); list.Add("One", "Finance"); list.Add("Two", "Marketing"); list.Add("Three", "Sales"); list.Add("Four", "Purchase"); list.Add("Five", "Operations"); list.Add("Six", "IT"); Console.WriteLine("SortedList elements..."); foreach(DictionaryEntry d in list) { Console.WriteLine(d.Key + " " + d.Value); } Console.WriteLine("Index at key ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
169 Views
To add key and value into StringDictionary, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo { public static void Main() { StringDictionary strDict = new StringDictionary(); strDict.Add("A", "John"); strDict.Add("B", "Andy"); strDict.Add("C", "Tim"); strDict.Add("D", "Ryan"); strDict.Add("E", "Kevin"); strDict.Add("F", "Katie"); strDict.Add("G", "Brad"); Console.WriteLine("StringDictionary elements..."); foreach(DictionaryEntry de in strDict) { Console.WriteLine(de.Key + " " + de.Value); } ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
58 Views
Let us see how to implement Bitwise exclusive OR operation between elements of BitArray −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(){ BitArray arr1 = new BitArray(5); BitArray arr2 = new BitArray(5); arr1[0] = false; arr1[1] = false; arr2[0] = false; arr2[1] = true; Console.WriteLine("BitArray1 elements..."); foreach (bool res in arr1){ Console.WriteLine(res); } Console.WriteLine("BitArray2 elements..."); foreach (bool ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
80 Views
To add an object to the end of the ArrayList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(String[] args){ ArrayList list = new ArrayList(); list.Add("Tim"); list.Add("Katie"); list.Add("Amy"); list.Add("Carlos"); list.Add("Chris"); list.Add("Jason"); Console.WriteLine("Elements in ArrayList..."); foreach (string res in list){ Console.WriteLine(res); } } }OutputThis will produce the following output −Elements in ArrayList... Tim Katie Amy Carlos ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
71 Views
To create a SortedSet, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(){ SortedSet set1 = new SortedSet(); set1.Add("AB"); set1.Add("BC"); set1.Add("CD"); set1.Add("EF"); Console.WriteLine("Elements in SortedSet1..."); foreach (string res in set1){ Console.WriteLine(res); } SortedSet set2 = new SortedSet(); set2.Add("BC"); set2.Add("CD"); set2.Add("DE"); set2.Add("EF"); set2.Add("AB"); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
208 Views
To check the current state of a thread, the code is as follows −Example Live Demousing System; using System.Threading; public class Demo { public static void Main(){ Thread thread = new Thread(new ThreadStart(demo1)); ThreadPool.QueueUserWorkItem(new WaitCallback(demo2)); Console.WriteLine("Current state of Thread = "+thread.ThreadState); Console.WriteLine("ManagedThreadId = "+thread.ManagedThreadId); } public static void demo1(){ Thread.Sleep(2000); } public static void demo2(object stateInfo){ Console.WriteLine("Thread belongs to managed thread pool? = "+Thread.CurrentThread.IsThreadPoolThread); } }OutputThis will produce the following output −Current state of Thread = Unstarted ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
207 Views
To add key/value pairs in SortedList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(String[] args){ SortedList list = new SortedList(); list.Add("A", "Jacob"); list.Add("B", "Sam"); list.Add("C", "Tom"); list.Add("D", "John"); list.Add("E", "Tim"); list.Add("F", "Mark"); list.Add("G", "Gary"); list.Add("H", "Nathan"); list.Add("I", "Shaun"); list.Add("J", "David"); ICollection col1 = list.Values; Console.WriteLine("Values..."); foreach(string s ... Read More