Kiểm tra xem key có tồn tại không với ContainsKey(<key>) or TryGetValue (<key>, out <value>)
Lặp qua dictionary hay dictionary.Keys hay dictionary.Values
Một số kiểu Dictionaries
Dictionary <K, V>: phổ biến nhất, key không sắp xếp
SortedList <K, V>: key đc sắp xếp, nhanh hơn khi chuyển dữ liệu đã được sắp xếp vào SortedList
SortedDictionary <K, V>: key đc sắp xếp, nhanh hơn khi chuyển dữ liệu chưa đc sắp xếp
Using Collection Interfaces
dùng tham số có kiểu interface thay vì 1 kiểu concrete, ví dụ: IList (có thể dùng cả List lẫn Array) hay ICollection (có thể dùng cả Array, List, Dictionary)
dùng làm kiểu dữ liệu trả về, ví dụ hàm getProductList() có thể trả về Array, List, Dictionary khi khai báo kiểu dữ liệu trả về ICollection
Nodejs developer. Working in a tech education company - Techmastervn with a vision to promote STEM and provide valuable as well as affordable IT training to students and young adults