本文整理汇总了C#中UserGroup.InGroup方法的典型用法代码示例。如果您正苦于以下问题:C# UserGroup.InGroup方法的具体用法?C# UserGroup.InGroup怎么用?C# UserGroup.InGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserGroup
的用法示例。
在下文中一共展示了UserGroup.InGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Regroup
/// <summary>
/// Regroup
/// </summary>
public void Regroup(string ubound, string lbound, User.UserList users)
{
int i;
UserGroup group = new UserGroup();
group.UpperBound = ubound; group.LowerBound = lbound;
for (i = 0; i < users.Count; i++) {
User user = users[i] as User;
if (!group.InGroup(user.LastName)) {
users.Remove(user);
i--;
}
}
}
示例2: Setup
private ArrayList Setup(User.UserList users)
{
ArrayList groups = new ArrayList();
int i;
for (i = 0; i < alphabet.Length; i++) {
string bound = alphabet[i];
UserGroup group = new UserGroup();
group.UpperBound = alphabet[i];
if (i == alphabet.Length - 1)
group.LowerBound = bound;
else
group.LowerBound = alphabet[i+1];
foreach (User user in users)
if (group.InGroup(user.LastName))
group.Users.Add(user);
groups.Add(group);
}
return groups;
}
示例3: Divide
private bool Divide(ArrayList groups, int binsize)
{
bool workdone=false;
int i;
for (i = 0; i < groups.Count; i++) {
UserGroup group = (UserGroup) groups[i];
if (group.Users.Count > binsize) {
//Split in half
UserGroup left = new UserGroup();
UserGroup right = new UserGroup();
string newdiv = GetMedian(group);
if (newdiv == null) continue; //Give up
string divpoint = group.UpperBound+newdiv;
left.UpperBound = group.UpperBound;
left.LowerBound = divpoint;
right.UpperBound = divpoint;
right.LowerBound = group.LowerBound;
foreach (User user in group.Users) {
if (left.InGroup(user.LastName))
left.Users.Add(user);
else
right.Users.Add(user);
}
workdone=true;
groups.Remove(group);
groups.Insert(i, left); groups.Insert(i+1, right);
i--;
}
}
return workdone;
}