
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 2587 Articles for Csharp

107 Views
To get the list of values of 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("A", 1); list.Add("B ", 2); list.Add("C ", 3); list.Add("D", 4); list.Add("E", 5); list.Add("F", 6); list.Add("G", 7); list.Add("H", 8); Console.WriteLine("SortedList elements..."); foreach(DictionaryEntry d in list) { Console.WriteLine(d.Key + ... Read More

724 Views
To get the list of keys of 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 list1 = new SortedList(); list1.Add("One", 1); list1.Add("Two ", 2); list1.Add("Three ", 3); list1.Add("Four", 4); list1.Add("Five", 5); list1.Add("Six", 6); list1.Add("Seven ", 7); list1.Add("Eight ", 8); list1.Add("Nine", 9); list1.Add("Ten", 10); Console.WriteLine("SortedList1 elements..."); ... Read More

115 Views
To get or set the number of elements in the BitArray, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main() { BitArray arr1 = new BitArray(2); BitArray arr2 = new BitArray(2); arr1[0] = false; arr1[1] = true; Console.WriteLine("BitArray1 length = "+arr1.Length); Console.WriteLine("Elements in BitArray1..."); foreach (bool res in arr1) { Console.WriteLine(res); } arr2[0] = false; arr2[1] ... Read More

136 Views
To compute the Union of SortedSet to a Collection, 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(50); set1.Add(100); set1.Add(150); Console.WriteLine("SortedSet1 elements..."); foreach(int ele in set1) { Console.WriteLine(ele); } SortedSet set2 = new SortedSet(); set2.Add(100); set2.Add(150); set2.Add(200); set2.Add(250); Console.WriteLine("SortedSet2 elements..."); ... Read More

90 Views
Let us see how to implement Bitwise OR operation between the 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..."); ... Read More

963 Views
To get or set the element at the specified index in ArrayList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main() { ArrayList arrList = new ArrayList(); arrList.Add("Laptop"); arrList.Add("Desktop"); arrList.Add("Notebook"); arrList.Add("Ultrabook"); arrList.Add("Tablet"); arrList.Add("Headphone"); arrList.Add("Speaker"); Console.WriteLine("Elements in ArrayList..."); foreach(string str in arrList) { Console.WriteLine(str); } Console.WriteLine("Element at index 5 = " ... Read More

261 Views
To get or set the element at specified index in Collection, the code is as follows −Example Live Demousing System; using System.Collections.ObjectModel; public class Demo { public static void Main() { Collection col = new Collection(); col.Add("Laptop"); col.Add("Desktop"); col.Add("Notebook"); col.Add("Ultrabook"); col.Add("Tablet"); col.Add("Headphone"); col.Add("Speaker"); Console.WriteLine("Elements in Collection..."); foreach(string str in col) { Console.WriteLine(str); } Console.WriteLine("Element at index 3 = " + ... Read More

143 Views
To get or set at specified index in StringCollection, the code is as follows −Example Live Demousing System; using System.Collections.Specialized; public class Demo { public static void Main() { StringCollection strCol = new StringCollection(); String[] strArr = new String[] { "A", "B", "C", "D", "E", "F", "G", "H" }; Console.WriteLine("StringCollection elements..."); foreach (string str in strArr) { Console.WriteLine(str); } strCol.AddRange(strArr); Console.WriteLine("Element at 5th index = "+strCol[5]); } }OutputThis will produce the following output −StringCollection elements... ... Read More

102 Views
To check if SortedSet and a specified collection share common element, 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(100); set1.Add(200); set1.Add(300); set1.Add(400); set1.Add(500); set1.Add(600); SortedSet set2 = new SortedSet(); set2.Add(100); set2.Add(200); set2.Add(300); set2.Add(400); set2.Add(500); set2.Add(600); Console.WriteLine("Does it ... Read More

165 Views
To get the capacity of a SortedList, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo { public static void Main(String[] args){ SortedList sortedList = new SortedList(); sortedList.Add("A", "1"); sortedList.Add("B", "2"); sortedList.Add("C", "3"); sortedList.Add("D", "4"); sortedList.Add("E", "5"); sortedList.Add("F", "6"); sortedList.Add("G", "7"); sortedList.Add("H", "8"); sortedList.Add("I", "9"); sortedList.Add("J", "10"); Console.WriteLine("SortedList elements..."); foreach(DictionaryEntry d in sortedList){ ... Read More