C# nullable string error

前端 未结 6 1946
梦如初夏
梦如初夏 2020-11-27 05:19
private string? typeOfContract
{
  get { return (string?)ViewState[\"typeOfContract\"]; }
  set { ViewState[\"typeOfContract\"] = value; }
}

Later

6条回答
  •  借酒劲吻你
    2020-11-27 05:35

    You are making it complicated. string is already nullable. You don't need to make it more nullable. Take out the ? on the property type.

提交回复
热议问题