考慮從ASP.NET MVC的源代碼this code:使用[NOTNULL對於一個方法的參數
public static IApplicationBuilder UseMvc(
[NotNull] this IApplicationBuilder app,
[NotNull] Action<IRouteBuilder> configureRoutes) {...}
據this答案,註釋的參數不能爲空。那麼爲什麼我可以將null傳遞給方法?也就是說,在下面的情況下,編譯器爲什麼不給我任何錯誤?
app.UseMvc(null);
相關:[NotNull屬性](http://stackoverflow.com/q/30896853/464709)。 –