本文整理汇总了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
}
示例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();
}
示例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();
}