Hashtable was used in one request some time ago. I remember it was because of loops in multiple table queries. To reduce the performance problems caused by nested loops, I had another requirement this week, during the development process, hashtable-like functions must be used, but each key corresponds to a list. In msdn, dictionary is found to help ,, I found not many legends about it on the Internet. I continued to study it in msdn and finally got it out. Haha.
Write Data to Dictionary
1 Dictionary < Int , String > Sopackageids = New Dictionary < Int , String > ();
2 If (Util. hasmorerow (DTT ))
3 {
4 Foreach (Datarow DRR In DTT. Rows)
5 {
6 String Temp = DRR [ " A " ]. Tostring () + " : " + DRR [ " B " ]. Tostring () + " , Warehouse: " + DRR [ " C " ] + " <Br/> " ;
7 Int Sono = ( Int ) DRR [ " Sysno " ];
8 If (Sopackageids. containskey (sono) = True )
9 Sopackageids [Sono] + = Temp;
10 Else
11 Sopackageids. Add (sono, temp );
12 }
13 } Read data
1 If (Sopackageids. containskey (sosysno) = True )
2 Packageids = Sopackageids [sosysno]. trimend ( New Char [] {',',' '} );
In this case, it's okay. It's easy to use... post for your reference ....