Delen via


UserManager<TUser>.AddToRolesAsync Method

Definition

Add the specified user to the named roles.

public:
 virtual System::Threading::Tasks::Task<Microsoft::AspNetCore::Identity::IdentityResult ^> ^ AddToRolesAsync(TUser user, System::Collections::Generic::IEnumerable<System::String ^> ^ roles);
public virtual System.Threading.Tasks.Task<Microsoft.AspNetCore.Identity.IdentityResult> AddToRolesAsync (TUser user, System.Collections.Generic.IEnumerable<string> roles);
abstract member AddToRolesAsync : 'User * seq<string> -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Identity.IdentityResult>
override this.AddToRolesAsync : 'User * seq<string> -> System.Threading.Tasks.Task<Microsoft.AspNetCore.Identity.IdentityResult>
Public Overridable Function AddToRolesAsync (user As TUser, roles As IEnumerable(Of String)) As Task(Of IdentityResult)

Parameters

user
TUser

The user to add to the named roles.

roles
IEnumerable<String>

The name of the roles to add the user to.

Returns

The Task that represents the asynchronous operation, containing the IdentityResult of the operation.

Applies to