Thursday, June 14, 2018


This has the following example of a NotNull attribute which is also mentioned in "ASP.NET Core 2 and Angular 5" by Valerio De Sanctis.

public static IApplicationBuilder UseMvc([NotNull] this IApplicationBuilder app,
      [NotNull] Action<IRouteBuilder> configureRoutes) {


The Stack Overflow link I provide also mentions that this is Microsoft's MVC 6 source code and not some random C# that someone wrote. [NotNull] is really not something for you to use yourself in C#. These are really just annotations provided to make ReSharper understand what is going on better in being helpful and not for example a compiler-level safeguard against handing in a null value. This has some more on how you might loop in a JetBrains library to use these, but keep it mind that this is something esoteric (wacky) and not a pillar of C# that you'll get asked about in an interview.

No comments:

Post a Comment