- 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)
58 Views
To check if ListDictionary contains a specific key, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo { public static void Main() { ListDictionary dict1 = new ListDictionary(); dict1.Add("A", "Books"); dict1.Add("B", "Electronics"); dict1.Add("C", "Smart Wearables"); dict1.Add("D", "Pet Supplies"); dict1.Add("E", "Clothing"); dict1.Add("F", "Footwear"); Console.WriteLine("ListDictionary1 elements..."); foreach(DictionaryEntry d in dict1) { Console.WriteLine(d.Key + " " + d.Value); } ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
280 Views
To get an enumerator that iterates through HashSet, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main(String[] args) { HashSet set1 = new HashSet(); set1.Add("A"); set1.Add("B"); set1.Add("C"); set1.Add("D"); set1.Add("E"); set1.Add("F"); set1.Add("G"); set1.Add("H"); Console.WriteLine("Elements in HashSet1..."); foreach (string res in set1) { Console.WriteLine(res); } HashSet set2 = new ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
179 Views
To get the HashCode for the string, the code is as follows, the code is as follows −Example Live Demousing System; public class Demo { public static void Main(String[] args) { string str1 = "Akon"; string str2 = "Eminem"; Console.WriteLine("String 1 = "+str1); Console.WriteLine("HashCode of String 1 = "+str1.GetHashCode()); Console.WriteLine("String 2 = "+str2); Console.WriteLine("HashCode of String 2 = "+str2.GetHashCode()); Console.WriteLine("String 1 is equal to String 2: {0}", str1.Equals(str2)); } }OutputThis will produce the following output −String 1 = Akon HashCode of String 1 = 416613838 String 2 = Eminem ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
179 Views
To get the number of nodes contained in the LinkedList, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main() { LinkedList list = new LinkedList(); list.AddLast("A"); list.AddLast("B"); list.AddLast("C"); list.AddLast("D"); list.AddLast("E"); list.AddLast("F"); list.AddLast("G"); list.AddLast("H"); list.AddLast("I"); list.AddLast("J"); Console.WriteLine("Count of nodes = " + list.Count); Console.WriteLine("First Node = "+list.First.Value); list.Clear(); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
58 Views
To check if HybridDictionary has fixed size, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo { public static void Main() { HybridDictionary dict1 = new HybridDictionary(); dict1.Add("A", "Books"); dict1.Add("B", "Electronics"); dict1.Add("C", "Smart Wearables"); dict1.Add("D", "Pet Supplies"); dict1.Add("E", "Clothing"); dict1.Add("F", "Footwear"); Console.WriteLine("HybridDictionary1 elements..."); foreach(DictionaryEntry d in dict1) { Console.WriteLine(d.Key + " " + d.Value); } Console.WriteLine("Is ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
114 Views
To add new node or value at the end of LinkedList, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo { public static void Main() { LinkedList list = new LinkedList(); list.AddLast("A"); list.AddLast("B"); list.AddLast("C"); list.AddLast("D"); list.AddLast("E"); list.AddLast("F"); Console.WriteLine("Count of nodes = " + list.Count); Console.WriteLine("Elements in LinkedList..."); foreach (string res in list) { Console.WriteLine(res); } ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
152 Views
To add elements 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("Andy"); list.Add("Gary"); list.Add("Katie"); list.Add("Amy"); Console.WriteLine("Elements in ArrayList..."); foreach (string res in list) { Console.WriteLine(res); } string[] strArr = { "John", "Jacob" }; list.AddRange(strArr); Console.WriteLine("Elements in ArrayList...UPDATED"); ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
193 Views
To add an element to 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 list = new List(); list.Add("One"); list.Add("Two"); list.Add("Three"); list.Add("Four"); list.Add("Five"); list.Add("Six"); list.Add("Seven"); list.Add("Eight"); Console.WriteLine("Enumerator iterates through the list elements..."); List.Enumerator demoEnum = list.GetEnumerator(); while (demoEnum.MoveNext()) { string res = demoEnum.Current; ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
80 Views
To check if SortedDictionary contains the specified key or not, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Generic; public class Demo { public static void Main() { SortedDictionary sortedDict = new SortedDictionary(); sortedDict.Add(100, "Mobile"); sortedDict.Add(200, "Laptop"); sortedDict.Add(300, "Desktop"); sortedDict.Add(400, "Speakers"); sortedDict.Add(500, "Headphone"); sortedDict.Add(600, "Earphone"); Console.WriteLine("SortedDictionary key-value pairs..."); IDictionaryEnumerator demoEnum = sortedDict.GetEnumerator(); while (demoEnum.MoveNext()) Console.WriteLine("Key = " + demoEnum.Key + ", Value = ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
73 Views
To check if Hashtable is synchronized, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main() { Hashtable hash = new Hashtable(); hash.Add("One", "Katie"); hash.Add("Two", "John"); hash.Add("Three", "Barry"); hash.Add("Four", ""); hash.Add("Five", "Harry"); hash.Add("Six", "F"); hash.Add("Seven", "Tom"); hash.Add("Eight", "Andy"); hash.Add("Nine", "I"); hash.Add("Ten", "Tim"); Console.WriteLine("Hashtable Key and Value pairs..."); foreach(DictionaryEntry entry in hash) { ... Read More