您的位置:首页 > 编程语言 > C#

C#:使用Hashtable实现输出那些用户发表主题最多的信息

2015-08-20 00:41 513 查看
构思:先计算各自的数量,那些数量最多,输出详细信息

具体算法如下:

class Program
{

static void Main(string[] args)
{
const string clmnUid = "uid";
const string clmnName = "name";
Data data = new Data();
DataTable users = data.initUsers();
DataTable subjects = data.initSujects();

Hashtable uidsCount = Count.EntityCount(subjects, clmnUid);
Hashtable maxCountUids = Count.MaxCountUid(uidsCount);
Count.PrintMaxCountName(maxCountUids,users,clmnUid,clmnName);

Console.Read();
}
}


View Code
输出结果:
uid0:name0(13)

uid1:name1(13)

uid2:name2(13)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: