为什么这不起作用?似乎是有效的代码。
string cert = ddCovCert.SelectedValue;
int? x = (string.IsNullOrEmpty(cert)) ? null: int.Parse(cert);
Display(x);
我应该如何编码?该方法采用 Nullable。如果下拉选择了一个字符串,我需要将其解析为一个 int 否则我想将 null 传递给该方法。
为什么这不起作用?似乎是有效的代码。
string cert = ddCovCert.SelectedValue;
int? x = (string.IsNullOrEmpty(cert)) ? null: int.Parse(cert);
Display(x);
我应该如何编码?该方法采用 Nullable。如果下拉选择了一个字符串,我需要将其解析为一个 int 否则我想将 null 传递给该方法。