C# nullable string error

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

Later

6条回答
  •  醉话见心
    2020-11-27 05:54

    System.String is a reference type and already "nullable".

    Nullable and the ? suffix are for value types such as Int32, Double, DateTime, etc.

提交回复
热议问题