How can I make my string property nullable?

前端 未结 9 1002
爱一瞬间的悲伤
爱一瞬间的悲伤 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:33

    Strings are nullable in C# anyway because they are reference types. You can just use public string CMName { get; set; } and you'll be able to set it to null.

提交回复
热议问题