C# Language nameof Operator Strongly typed MVC action links

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

Instead of the usual loosely typed:

@Html.ActionLink("Log in", "UserController", "LogIn")

You can now make action links strongly typed:

@Html.ActionLink("Log in", @typeof(UserController), @nameof(UserController.LogIn))

Now if you want to refactor your code and rename the UserController.LogIn method to UserController.SignIn, you don't need to worry about searching for all string occurrences. The compiler will do the job.



Got any C# Language Question?