为了在通用类型或方法“ System.Nullable< T>”中将其用作参数“ T”,类型“字符串”必须为非空值类型。
public virtual int Fill(DataSetservices.Jobs_detailsDataTable dataTable,
global::System.Nullable<global::System.String> fromdate,
global::System.Nullable<global::System.DateTime> todate)
我在中的c> dataset.xsd
,但抛出错误:
错误1
字符串类型必须是不可为空的值类型,以便
在通用类型或方法
'System.Nullable'
Error 1
The type 'string' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'System.Nullable'
建议我如何使用字符串,因为我想使用字符串而不是其他
Suggest me how to use string because i want to use string and nothing else
string
已经可以为空,因为它是引用类型。您无需将其包装在 Nullable
中即可具有空值。不仅不需要它,而且根据您收到的错误消息,它甚至都不是可能。只有非空值类型可以用作 Nullable
的通用参数。
string
is already nullable, because it's a reference type. You don't need to wrap it in Nullable
in order to have a null value. Not only is it not needed, but as per the error message you're getting, it's not even possible. Only non-nullable value types can be used as the generic argument for Nullable
.