I'm new in asp.net, I have a problem with structs
This is my struct:
public struct Attribute
{
public const string Name = "name";
public const string Desc= "short_description";
public const string Width= "description";
public const string Height= "package_length";
}
This is my code :
var jsonValue = JsonConvert.SerializeObject(ValueFromAPI);
Dictionary<string, object> dictValues = JsonConvert.DeserializeObject<Dictionary<string, object>>(jsonValue );
foreach (var dictValue in dictValues )
{
if(dictValue.Key == Attribute.Name)
{
//mycode
}
else if(dictValue.Key == Attribute.Desc)
{
//mycode
}
else if(dictValue.Key == Attribute.Width)
{
//mycode
}
else if(dictValue.Key == Attribute.Heigth)
{
//mycode
}
}
how to check Attribute properties
is contain jsonValue
Key without using if else
because I have a lot of attribute properties
, for now, I check one by one using if else
Thanks!