What does The non-generic method cannot be used with type arguments mean in this context?

c#

Solution

As the error says, `FindByIdAsync` does not take type parameters. These exist on the declaring class `UserManager<TUser, TKey>`

var user = await UserManager.FindByIdAsync(99);

Problem

I have the following class and method: ``` public class UserManager<TUser, TKey> : IDisposable where TUser : class, global::Microsoft.AspNet.Identity.IUser<TKey> where TKey : global::System.IEquatable<TKey> { public virtual Task<TUser> FindByIdAsync(TKey userId); ``` and: ``` private ApplicationUserManager _userManager; public ApplicationUserManager UserManager { get { return _userManager ?? Request.GetOwinContext().GetUserManager<ApplicationUserManager>(); } set { _userManager = value; } } public class ApplicationUserManager : UserManager<ApplicationUser, int> public class ApplicationUser : IdentityUser<int, CustomUserLogin, CustomUserRole, CustomUserClaim> ``` I am trying to call this method like this: ``` var user = await UserManager.FindByIdAsync<ApplicationUser,int>(99); ``` It gives me the error: The non-generic method 'Microsoft.AspNet.Identity.UserManager.FindByIdAsync(int)' cannot be used with type arguments

Original source