C#C
C#2y ago
hutonahill

✅ Understanding and working around `this`

I am developing an API that uses .NET 8 Identity. i had it all up and running, but i needed the default endpoints defined in app.MapIdentityApi<IdentityUser>() to work a little differently. i was told in order to get this functionality i needed to re impliment those endpoints. So i dug into the libraries (spesificly IdentityApiEndpointRouteBuilderExtensions.cs in the namespace Microsoft.AspNetCore.Routing), found MapIdentityApi, and coppied it into Program.cs.

So far so good. ive coppied in a bunch of other code and ive got it all working... Except... the signiture:
 public static IEndpointConventionBuilder MapIdentityApi<TUser>(this IEndpointRouteBuilder endpoints)
        where TUser : class, new(){


I have no idea what to do about this IEndpointRouteBuilder endpoints. What does the this keyword do? how can i simulate the functionality of the endpoints parameter? Is this a lost cause? Why don't libraries have comments?
Was this page helpful?