本文整理汇总了C#中StringCollection.GetKey方法的典型用法代码示例。如果您正苦于以下问题:C# StringCollection.GetKey方法的具体用法?C# StringCollection.GetKey怎么用?C# StringCollection.GetKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringCollection
的用法示例。
在下文中一共展示了StringCollection.GetKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindUsersByName
public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
{
MembershipUserCollection users = new MembershipUserCollection();
try
{
using (DataSet ds = this.OpenXml())
{
DataRow[] dr = this.SearchByFieldValue(ds, "Users", "Username", usernameToMatch, pageIndex, pageSize);
StringCollection usrNms = new StringCollection();
for (int i = 0; i < dr.Length; i++)
usrNms.Add(dr[i]["LoweredUserName"].ToString(), i.ToString());
usrNms.Sort(Collections.SortDirection.Ascending);
for (int i = 0; i < usrNms.Count; i++)
{
DataRow drUsr = dr[int.Parse(usrNms.GetKey(i))];
users.Add(this.PopulateMembershipUser(drUsr, this.GetMembershipEntry(drUsr["UserId"], ds)));
}
//for (int i = 0; i < dr.Length; i++)
// users.Add(this.PopulateMembershipUser(dr[i], this.GetMembershipEntry(dr[i]["UserId"], ds)));
totalRecords = ds.Tables["Users"].Rows.Count;
}
}
catch
{ throw; }
return users;
}
示例2: GetAllUsers
public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
{
try
{
MembershipUserCollection users = new MembershipUserCollection();
using (DataSet ds = this.OpenXml())
{
StringCollection usrNms = new StringCollection();
for (int i = 0; i < ds.Tables["Users"].Rows.Count; i++)
usrNms.Add(ds.Tables["Users"].Rows[i]["LoweredUserName"].ToString(), i.ToString());
usrNms.Sort(Collections.SortDirection.Ascending);
for (int i = 0; i < usrNms.Count; i++)
{
DataRow drUsr = ds.Tables["Users"].Rows[int.Parse(usrNms.GetKey(i))];
users.Add(this.PopulateMembershipUser(drUsr, this.GetMembershipEntry(drUsr["UserId"], ds)));
}
//for (int i = 0; i < ds.Tables["Users"].Rows.Count; i++)
// users.Add(this.PopulateMembershipUser(ds.Tables["Users"].Rows[i], this.GetMembershipEntry(ds.Tables["Users"].Rows[i]["UserId"], ds)));
totalRecords = ds.Tables["Users"].Rows.Count;
}
return users;
}
catch
{ throw; }
}