Narasiman nar

Narasiman nar

  • NA
  • 64
  • 22.1k

how to validate dict in c#

May 28 2018 8:10 AM
 
 My code as follows
 
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());
  if (dict!=null && dict!= string.Empty)
    {
      string str = string.Empty;
      lst.AddRange(dict.Keys); 
   } 
 
 when i run shows error as follows
Operator '!=' cannot be applied to operands of type 'Dictionary<string, string>' and 'string' 
 
how to fix this error. 
 
 

Answers (3)