Add value to SortedList and get contents by integer indexes : SortedList « Data Structure « C# / CSharp Tutorial

C# / CSharp Tutorial
1. Language Basics
2. Data Type
3. Operator
4. Statement
5. String
6. struct
7. Class
8. Operator Overload
9. delegate
10. Attribute
11. Data Structure
12. Assembly
13. Date Time
14. Development
15. File Directory Stream
16. Preprocessing Directives
17. Regular Expression
18. Generic
19. Reflection
20. Thread
21. I18N Internationalization
22. GUI Windows Forms
23. 2D
24. Design Patterns
25. Windows
26. XML
27. ADO.Net
28. Network
29. Directory Services
30. Security
31. unsafe
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorial
C# / C Sharp
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
C# / CSharp Tutorial » Data Structure » SortedList 
11. 33. 1. Add value to SortedList and get contents by integer indexes
using System; 
using System.Collections; 
 
class MainClass 
  public static void Main() { 
    SortedList sl = new SortedList()
     
    sl.Add("a""A")
    sl.Add("b""B")
    sl.Add("c""C")
    sl.Add("d""D")
 
    // Get a collection of the keys. 
    ICollection c = sl.Keys; 
 
    // Display list using integer indexes. 
    Console.WriteLine("Contents by integer indexes.")
    for(int i=0; i<sl.Count; i++
      Console.WriteLine(sl.GetByIndex(i))
      
  }
}
Contents by integer indexes.
A
B
C
D
11. 33. SortedList
11. 33. 1. Add value to SortedList and get contents by integer indexes
11. 33. 2. Add element to SortedList by using the indexer.
11. 33. 3. Show integer indexes of entries
11. 33. 4. Get value by key indexer
11. 33. 5. Use the ContainsValue() method to check if mySortedList contains a value
11. 33. 6. Use the Remove() method to remove a key from SortedList
11. 33. 7. Get the key at index 3 using the GetKey() method
11. 33. 8. Get the index of the element with a key using the IndexOfKey() method
11. 33. 9. Get the index of the element with a value using the IndexOfValue() method
11. 33. 10. Get the key list using the GetKeyList() method
11. 33. 11. Get the value list using the GetValueList() method
ww_w__.___ja_v_a_2s__.__co_m___ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.