<方法一>int[] arr ={
Dictionary<int
foreach (int i in arr)
{
if (dic
dic = dic +
else
dic
}
//查看結果
foreach (int j in dic
{
richTextBox
}
<方法二>int[] arr = {
var query =
from a in arr
group arr by a into g
orderby g
select new
{
g
count = g
};
foreach (var i in query)
{
Console
}
From:http://tw.wingwit.com/Article/program/sjjg/201405/30734.html