I'm trying to return a value once it finds the string match. I'm using the following code.
MetadataIcons mi = new MetadataIcons();
Type me = mi.GetType();
PropertyInfo[] pi = me.GetProperties();
foreach (var property in pi)
if (property.Name.ToLower().Equals(prop.ToLower()))
return property.GetValue(prop).ToString();
But, I get the error "Not all paths return a value" I thought I was able to do so that way. Do I really need to specific a return variable?
Aucun commentaire:
Enregistrer un commentaire