- 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
What is the Values property of SortedList class in C#?
Firstly, declare the SortedList class −
SortedList list = new SortedList();
Now add the values −
list.Add("S1", "Wallets"); list.Add("S2", "Sunglasses"); list.Add("S3", "Backpacks");
The following is the code to work with Values property of SortedList class −
Example
using System; using System.Collections; namespace Demo { class Program { static void Main(string[] args) { SortedList list = new SortedList(); list.Add("S1", "Wallets"); list.Add("S2", "Sunglasses"); list.Add("S3", "Backpacks"); foreach (string value in list.Values) { Console.WriteLine(value); } } } }
Output
Wallets Sunglasses Backpacks
Advertisements