0

In code like so:

DataSet dsDuckbill = new DataSet();
DataTable dtDuckbill = dsDuckbill.Tables.Add("DSD");
dtDuckbill.Columns.Add("line_id", Type.GetType("System.Int32"));
dtDuckbill.Columns["line_id"].AutoIncrement = true;
dtDuckbill.Columns["line_id"].AutoIncrementSeed = 1;
dtDuckbill.Columns["line_id"].AutoIncrementStep = 1;

dtDuckbill.Columns.Add("vendor_id", Type.GetType("System.String"));
. . .

I get several, "Possible 'null' assignment to entity marked with 'NotNull' attribute"

I'm not sure if this is the right way to do it, but I was able to get past the first one this way:

DataSet dsDuckbill = new DataSet();
if (dsDuckbill.Tables.Contains("DSD"))
{
    DataTable dtDuckbill = dsDuckbill.Tables.Add("DSD");

...but I'm still getting that err msg on the first line for each line with "Type" (Resharper highlights "Type" as the culprit).

What's up with that (System.Int32 and System.String are possibly null?), and what need I do to mollify the R# beast?

4

0 回答 0