ÉèΪÊ×Ò³ ¼ÓÈëÊÕ²Ø

TOP

ÈçºÎËÑË÷һάÊý×éÖÐÖØ¸´ÔªËصĸöÊý?
2014-10-20 16:30:04 À´Ô´: ×÷Õß: ¡¾´ó ÖРС¡¿ ä¯ÀÀ:41´Î
Tags£ºÈçºÎ ËÑË÷ һάÊý ÖØ¸´ ÔªËØ ¸öÊý

<·½·¨Ò»>int[] arr ={ 12, 12, 12, 13, 13, 14, 14, 14, 14, 0 };
Dictionary dic = new Dictionary();
foreach (int i in arr)
{
if (dic.ContainsKey(i))
dic = dic + 1;
else
dic.Add(i, 1);
}
//²é¿´½á¹û
foreach (int j in dic.Keys)
{
richTextBox2.Text += j.ToString() + ¡°µÄ¸öÊýÓУº¡¡¡± + dic[j] + ¡°¸ö\n¡±;
}
<·½·¨¶þ>int[] arr = { 12, 12, 12, 13, 13, 14, 14, 14, 14, 0 };
var query =
from a in arr
group arr by a into g
orderby g.Count()
select new
{
g.Key,
count = g.Count()
};
foreach (var i in query)
{
Console.WriteLine(¡°{0}³öÏÖ{1}´Î¡±, i.Key, i.count);
}


¡¾´ó ÖРС¡¿¡¾´òÓ¡¡¿ ¡¾·±Ìå¡¿¡¾Í¶¸å¡¿¡¾Êղء¿ ¡¾ÍƼö¡¿¡¾¾Ù±¨¡¿¡¾ÆÀÂÛ¡¿ ¡¾¹Ø±Õ¡¿ ¡¾·µ»Ø¶¥²¿¡¿
·ÖÏíµ½: 
ÉÏһƪ£ºucwebÒ»ÃæÎÊÌâ ÏÂһƪ£ºÎ¨Æ·»áÃæÊÔ¾­Àú ¨C ûÄõ½OfferÍ..

ÆÀÂÛ

ÕÊ¡¡¡¡ºÅ: ÃÜÂë: (ÐÂÓû§×¢²á)
Ñé Ö¤ Âë:
±í¡¡¡¡Çé:
ÄÚ¡¡¡¡ÈÝ: