Narasiman nar

Narasiman nar

  • NA
  • 64
  • 22.1k

how to validate the null value in dictionary in c#

May 28 2018 7:06 AM
My code as follows
 
id     Name     farmdetailsdata
1     Test1     {"Product1":"A","Product2":"B"}
2     Test2
3     Test3     {"Product3":"C","Product2":"D"}
4     Test4     {"Product4":"C","Product5":"D"}
 
int columnindex = 43;
List<string> lst = new List<string>();
foreach (DataRow row in dtFarmerFarmReports.Rows)
{
var dict = JsonConvert.DeserializeObject<Dictionary<string, string>>(row["farm_detailsdata"].ToString());
}
 
from the above code how to validate dict is null or empty.
 
becuase in the above table for the ID 2 farmdetailsdata value is empty.
 
from the above code how to validate dict is null or empty.

Answers (1)