✅ 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:
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?11 Replies
The this modifier makes it an extension method
Extension Methods - C#
Extension methods in C# enable you to add methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type.
its an extention of IEndpointRuteBuilder?
Yes
huge.
thanks a ton!
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
If you have no further questions, please use /close to mark the forum thread as answered
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View
@TeBeCo You can just close it yourself I think?
yea but now i know
Unknown User•5mo ago
Message Not Public
Sign In & Join Server To View