{"id":500,"date":"2016-05-18T22:17:35","date_gmt":"2016-05-18T22:17:35","guid":{"rendered":"cee631121c2ec9232f3a2f028ad5c89b"},"modified":"2016-05-18T22:17:35","modified_gmt":"2016-05-18T22:17:35","slug":"","status":"publish","type":"post","link":"https:\/\/www.xiaobo.li\/notes\/archives\/500","title":{"rendered":"C#\u96c6\u5408--Dictionary"},"content":{"rendered":"<p>\u5b57\u5178(dictionary)\u662f\u4e00\u4e2a\u96c6\u5408\uff0c\u5176\u4e2d\u6bcf\u4e2a\u5143\u7d20\u90fd\u662f\u4e00\u4e2a\u952e\/\u503c\u5bf9\u3002\u5b57\u5178(Dictionaries)\u662f\u5e38\u7528\u4e8e\u67e5\u627e\u548c\u6392\u5e8f\u7684\u5217\u8868\u3002<\/p>\n<p>.NET Framework\u901a\u8fc7IDictionary\u63a5\u53e3\u548cIDictionary&lt;TKey,TValue&gt;\u63a5\u53e3\uff0c\u4ee5\u53ca\u4e00\u4e9b\u5e38\u7528\u7684\u5b50\u5178\u4e86\u5b9a\u4e49\u4e86\u5b50\u5178\u534f\u8bae\u3002\u6bcf\u4e2a\u7c7b\u5728\u4ee5\u4e0b\u65b9\u9762\u5404\u6709\u4e0d\u540c\uff1a<\/p>\n<ul>\n<li>\u5143\u7d20\u662f\u5426\u5df2\u7ecf\u6392\u5e8f  <\/li>\n<li>\u5143\u7d20\u662f\u5426\u80fd\u901a\u8fc7\u7d22\u5f15\u6216\u952e\u6765\u83b7\u53d6  <\/li>\n<li>\u5b57\u5178\u7c7b\u662fgeneric\u7684\u8fd8\u662f\u975egeneric\u7684  <\/li>\n<li>\u5f53\u5b57\u6bb5\u8f83\u5927\u65f6\uff0c\u6839\u636e\u952e\u503c\u83b7\u53d6\u5143\u7d20\u901f\u5ea6\u7684\u5feb\u6162<\/li>\n<\/ul>\n<p>\u4e0b\u8868\u603b\u7ed3\u4e86\u6bcf\u4e2a\u5b57\u5178\u7c7b\uff0c\u4ee5\u53ca\u5b83\u4eec\u5728\u4e0a\u8ff0\u8fd9\u51e0\u4e2a\u65b9\u9762\u7684\u5dee\u5f02\u3002\u5b83\u4eec\u90fd\u662f\u5728\u4e00\u4e2a1.5G\u7684PC\u4e0a\u6267\u884c5000\u6b21\u64cd\u4f5c\u5f97\u5230\u7684\u4e00\u4e2a\u5e73\u5747\u503c\u3002<\/p>\n<table style=\"width:100%;\" border=\"1\" bordercolor=\"#CCCCCC\" cellpadding=\"1\" cellspacing=\"0\">\n<tbody>\n<tr>\n<td valign=\"top\" width=\"175\"><strong>Type<\/strong><\/td>\n<td valign=\"top\" width=\"82\"><strong>\u5185\u90e8\u7ed3\u6784<\/strong><\/td>\n<td valign=\"top\" width=\"49\"><strong>\u652f\u6301\u7d22\u5f15<\/strong><\/td>\n<td valign=\"top\" width=\"76\"><strong>\u5185\u5b58\u5360\u7528<\/strong><\/td>\n<td valign=\"top\" width=\"76\"><strong>\u968f\u673a\u63d2\u5165\u7684\u901f\u5ea6(\u6beb\u79d2)<\/strong><\/td>\n<td valign=\"top\" width=\"77\"><strong>\u987a\u5e8f\u63d2\u5165\u7684\u901f\u5ea6(\u6beb\u79d2)<\/strong><\/td>\n<td valign=\"top\" width=\"115\"><strong>\u6839\u636e\u952e\u83b7\u53d6\u5143\u7d20\u7684\u901f\u5ea6(\u6beb\u79d2)<\/strong><\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"175\"><span style=\"color:#ff0000;\">\u672a\u6392\u5e8f\u5b57\u5178<\/span><\/td>\n<td valign=\"top\" width=\"82\">&nbsp;<\/td>\n<td valign=\"top\" width=\"49\">&nbsp;<\/td>\n<td valign=\"top\" width=\"76\">&nbsp;<\/td>\n<td valign=\"top\" width=\"76\">&nbsp;<\/td>\n<td valign=\"top\" width=\"77\">&nbsp;<\/td>\n<td valign=\"top\" width=\"115\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"175\">Dictionary&lt;T,V&gt;<\/td>\n<td valign=\"top\" width=\"82\">\u54c8\u5e0c\u8868<\/td>\n<td valign=\"top\" width=\"49\">\u5426<\/td>\n<td valign=\"top\" width=\"76\">22<\/td>\n<td valign=\"top\" width=\"76\">30<\/td>\n<td valign=\"top\" width=\"77\">30<\/td>\n<td valign=\"top\" width=\"115\">20<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"175\">Hashtable<\/td>\n<td valign=\"top\" width=\"82\">\u54c8\u5e0c\u8868<\/td>\n<td valign=\"top\" width=\"49\">\u5426<\/td>\n<td valign=\"top\" width=\"76\">38<\/td>\n<td valign=\"top\" width=\"76\">50<\/td>\n<td valign=\"top\" width=\"77\">50<\/td>\n<td valign=\"top\" width=\"115\">30<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"175\">ListDictionary<\/td>\n<td valign=\"top\" width=\"82\">\u94fe\u8868<\/td>\n<td valign=\"top\" width=\"49\">\u5426<\/td>\n<td valign=\"top\" width=\"76\">36<\/td>\n<td valign=\"top\" width=\"76\">50000<\/td>\n<td valign=\"top\" width=\"77\">50000<\/td>\n<td valign=\"top\" width=\"115\">50000<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"175\">OrderedDictionary<\/td>\n<td valign=\"top\" width=\"82\">\u54c8\u5e0c\u8868<br \/>\n+\u6570\u7ec4<\/td>\n<td valign=\"top\" width=\"49\">\u662f<\/td>\n<td valign=\"top\" width=\"76\">59<\/td>\n<td valign=\"top\" width=\"76\">70<\/td>\n<td valign=\"top\" width=\"77\">70<\/td>\n<td valign=\"top\" width=\"115\">40<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"175\"><span style=\"color:#ff0000;\">\u6392\u5e8f\u5b57\u5178<\/span><\/td>\n<td valign=\"top\" width=\"82\">&nbsp;<\/td>\n<td valign=\"top\" width=\"49\">&nbsp;<\/td>\n<td valign=\"top\" width=\"76\">&nbsp;<\/td>\n<td valign=\"top\" width=\"76\">&nbsp;<\/td>\n<td valign=\"top\" width=\"77\">&nbsp;<\/td>\n<td valign=\"top\" width=\"115\">&nbsp;<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"175\">SortedDictionary&lt;K,V&gt;<\/td>\n<td valign=\"top\" width=\"82\">\u7ea2\u9ed1\u6811<\/td>\n<td valign=\"top\" width=\"49\">\u5426<\/td>\n<td valign=\"top\" width=\"76\">20<\/td>\n<td valign=\"top\" width=\"76\">130<\/td>\n<td valign=\"top\" width=\"77\">100<\/td>\n<td valign=\"top\" width=\"115\">120<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"175\">SortedList&lt;K,V&gt;<\/td>\n<td valign=\"top\" width=\"82\">2xArray<\/td>\n<td valign=\"top\" width=\"49\">\u662f<\/td>\n<td valign=\"top\" width=\"76\">20<\/td>\n<td valign=\"top\" width=\"76\">3300<\/td>\n<td valign=\"top\" width=\"77\">30<\/td>\n<td valign=\"top\" width=\"115\">40<\/td>\n<\/tr>\n<tr>\n<td valign=\"top\" width=\"175\">SortList<\/td>\n<td valign=\"top\" width=\"82\">2xArray<\/td>\n<td valign=\"top\" width=\"49\">\u662f<\/td>\n<td valign=\"top\" width=\"76\">27<\/td>\n<td valign=\"top\" width=\"76\">4500<\/td>\n<td valign=\"top\" width=\"77\">100<\/td>\n<td valign=\"top\" width=\"115\">180<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p> \u4ece\u65f6\u95f4\u590d\u6742\u5ea6\u6765\u8bb2\uff0c\u4ece\u5b57\u5178\u4e2d\u901a\u8fc7\u952e\u83b7\u53d6\u503c\u6240\u8017\u8d39\u7684\u65f6\u95f4\u5206\u522b\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>Hashtable, Dictionary\u548cOrderedDictionary\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3aO(1)<\/li>\n<li>SortedDictionary\u548cSortList\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3aO(logN)<\/li>\n<li>ListDictinary\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u4e3aO(n)<\/li>\n<\/ul>\n<p>n\u662f\u96c6\u5408\u5143\u7d20\u7684\u6570\u91cf\u3002<\/p>\n<p>&nbsp;<\/p>\n<p>\u6458\u81ea\uff1a http:\/\/www.cnblogs.com\/yang_sy\/p\/3678905.html<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b57\u5178(dictionary)\u662f\u4e00\u4e2a\u96c6\u5408\uff0c\u5176\u4e2d\u6bcf\u4e2a\u5143\u7d20\u90fd\u662f\u4e00\u4e2a\u952e\/\u503c\u5bf9\u3002\u5b57\u5178(Dictionaries)\u662f\u5e38\u7528\u4e8e\u67e5\u627e\u548c\u6392\u5e8f\u7684\u5217\u8868\u3002<\/p>\n<p>.NET Framework\u901a\u8fc7IDictionary\u63a5\u53e3\u548cIDictionary&lt;TKey,TValue&gt;\u63a5\u53e3\uff0c\u4ee5\u53ca\u4e00\u4e9b\u5e38\u7528\u7684\u5b50\u5178\u4e86\u5b9a\u4e49\u4e86\u5b50\u5178\u534f\u8bae\u3002\u6bcf\u4e2a\u7c7b\u5728\u4ee5\u4e0b\u65b9\u9762\u5404\u6709\u4e0d\u540c\uff1a<\/p>\n<ul>\n<li>\u5143\u7d20\u662f\u5426\u5df2\u7ecf\u6392\u5e8f  <\/li>\n<li>\u5143\u7d20\u662f\u5426\u80fd\u901a\u8fc7\u7d22\u5f15\u6216\u952e\u6765\u83b7\u53d6  <\/li>\n<li>\u5b57\u5178\u7c7b\u662fgeneric\u7684\u8fd8\u662f\u975egeneric\u7684  <\/li>\n<li>\u5f53\u5b57\u6bb5\u8f83\u5927\u65f6\uff0c\u6839\u636e\u952e\u503c\u83b7\u53d6\u5143\u7d20\u901f\u5ea6\u7684\u5feb\u6162<\/li>\n<\/ul>\n<p> <a href=\"https:\/\/www.xiaobo.li\/notes\/archives\/500\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[279],"tags":[],"class_list":["post-500","post","type-post","status-publish","format-standard","hentry","category-dotnet"],"_links":{"self":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/500","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/comments?post=500"}],"version-history":[{"count":0,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/posts\/500\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/media?parent=500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/categories?post=500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xiaobo.li\/notes\/wp-json\/wp\/v2\/tags?post=500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}