当前位置: 首页>>代码示例>>C#>>正文


C# StringCollection.GetKey方法代码示例

本文整理汇总了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;
        }
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:27,代码来源:XmlMembershipProvider.cs

示例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; }
 }
开发者ID:tenshino,项目名称:RainstormStudios,代码行数:25,代码来源:XmlMembershipProvider.cs


注:本文中的StringCollection.GetKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。