![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
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
Get an ICollection containing the values in HybridDictionary in C#
To get an ICollection containing the values in HybridDictionary, the code is as follows −
Example
using System; using System.Collections.Specialized; public class Demo { public static void Main(){ HybridDictionary dict = new HybridDictionary(); dict.Add("One", "Katie"); dict.Add("Two", "Andy"); dict.Add("Three", "Gary"); dict.Add("Four", "Mark"); dict.Add("Five", "Marie"); dict.Add("Six", "Sam"); dict.Add("Seven", "Harry"); dict.Add("Eight", "Kevin"); dict.Add("Nine", "Ryan"); String[] strArr = new String[dict.Count]; dict.Values.CopyTo(strArr, 0); for (int i = 0; i < dict.Count; i++) Console.WriteLine(strArr[i]); } }
Output
This will produce the following output −
Kevin Harry Mark Gary Katie Marie Sam Andy Ryan
Example
Let us see another example −
using System; using System.Collections.Specialized; public class Demo { public static void Main() { HybridDictionary dict = new HybridDictionary(); dict.Add("1", "A"); dict.Add("2", "B"); dict.Add("3", "C"); dict.Add("4", "D"); dict.Add("5", "E"); dict.Add("6", "F"); String[] strArr = new String[dict.Count]; dict.Values.CopyTo(strArr, 0); for (int i = 0; i < dict.Count; i++) Console.WriteLine(strArr[i]); } }
Output
This will produce the following output *minus'
A B C D E F
Advertisements