當前位置: 首頁>>代碼示例>>C#>>正文


C# StringCollection.ToStringArray方法代碼示例

本文整理匯總了C#中System.Collections.Specialized.StringCollection.ToStringArray方法的典型用法代碼示例。如果您正苦於以下問題:C# StringCollection.ToStringArray方法的具體用法?C# StringCollection.ToStringArray怎麽用?C# StringCollection.ToStringArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Collections.Specialized.StringCollection的用法示例。


在下文中一共展示了StringCollection.ToStringArray方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetAllRoles

        /// <summary>
        /// Grabs all the roles from the DB
        /// </summary>
        /// <returns>
        /// </returns>
        public override string[] GetAllRoles()
        {
            // get all roles...
            DataTable roles = DB.Current.GetRoles(ConnectionStringName, this.ApplicationName, null);

            // make a string collection to store the role list...
            var roleNames = new StringCollection();

            foreach (DataRow row in roles.Rows)
            {
                roleNames.Add(row["RoleName"].ToStringDBNull());
            }

            return roleNames.ToStringArray(); // return as a string array
        }
開發者ID:vzrus,項目名稱:VZF,代碼行數:20,代碼來源:YafRoleProvider.cs

示例2: GetUsersInRole

        /// <summary>
        /// Gets a list of usernames in a a particular role
        /// </summary>
        /// <param name="roleName">
        /// Rolename
        /// </param>
        /// <returns>
        /// List of Usernames
        /// </returns>
        public override string[] GetUsersInRole(string roleName)
        {
            if (roleName.IsNotSet())
            {
                ExceptionReporter.ThrowArgument("ROLES", "ROLENAMEBLANK");
            }

            DataTable users = DB.Current.FindUsersInRole(ConnectionStringName,this.ApplicationName, roleName);

            var userNames = new StringCollection();

            foreach (DataRow dr in users.Rows)
            {
                userNames.Add(dr["Username"].ToStringDBNull());
            }

            return userNames.ToStringArray();
        }
開發者ID:vzrus,項目名稱:VZF,代碼行數:27,代碼來源:YafRoleProvider.cs

示例3: FindUsersInRole

        /// <summary>
        /// Adds a list of users to a list of groups
        /// </summary>
        /// <param name="roleName">
        /// Rolename
        /// </param>
        /// <param name="usernameToMatch">
        /// like Username used in search
        /// </param>
        /// <returns>
        /// List of Usernames
        /// </returns>
        public override string[] FindUsersInRole(string roleName, string usernameToMatch)
        {
            if (roleName.IsNotSet())
              {
            ExceptionReporter.ThrowArgument("ROLES", "ROLENAMEBLANK");
              }

              // Roles
              DataTable users = FbDB.Current.FindUsersInRole( this.ApplicationName, roleName);
              var usernames = new StringCollection();
              foreach (DataRow user in users.Rows)
              {
            usernames.Add(user["Username"].ToStringDBNull());
              }

              return usernames.ToStringArray();
        }
開發者ID:vzrus,項目名稱:YetAnotherForumExtraDataLayers,代碼行數:29,代碼來源:YafRoleProvider.cs


注:本文中的System.Collections.Specialized.StringCollection.ToStringArray方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。