NotNull attribute

前端 未结 1 1182
萌比男神i
萌比男神i 2020-12-29 01:28

I\'m looking at asp.net vnext engineering guideline and have noticed that they recommend to use NotNull attribute instead of explicit checking of input argument

1条回答
  •  一生所求
    2020-12-29 01:31

    The NotNullAttribute is gone. It was replaced with conditionally throwing ArgumentNullException and subsequently removed by the ASP.NET team. As of Jan 12, 2016 there's no plan to bring it back. (At that time, I was working on the ASP.NET team.)


    The attribute will be replaced through a pre-compilation step, using Roslyn, by code that does the actual check.

    However, the feature is not yet ready as of Jun 17, 2015. It will come in a later version. So far, it is just an empty internal attribute that should be implemented in each project again:

    [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
    internal sealed class NotNullAttribute : Attribute
    {
    }
    

    0 讨论(0)
提交回复
热议问题