Dictionary is really strong.

Source: Internet
Author: User
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 ....

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.