本文整理匯總了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();
}