How can I make my string property nullable?

前端 未结 9 1033
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-14 00:08

I want to make the Middle Name of person optional. I have been using C#.net code first approach. For integer data type its easy just by using ? operator to make

9条回答
  •  长情又很酷
    2020-12-14 00:24

    System.String is a reference type so you don't need to do anything like

    Nullable
    

    It already has a null value (the null reference):

    string x = null; // No problems here
    

提交回复
热议问题