Reputation: 2598
I am getting the error Object does not match target type
. I understand why I should be getting the error. But I am assigning a double
to a double
.
I am not sure why I am getting the error in the code below.
The code I am having issue with:
...
var specTran = new SpecTran(gapRecord);
foreach (var result in yields._predictions)
{
var type = specTran.GetType(); // --> {Name = "SpecTran" FullName = "GAP.Models.Database.SpecTran"}
var prop = type.GetProperty(result.Key); // --> {Double DexaCWT}
if (prop == null)
continue;
prop.SetValue(
(double)result.Value, // --> {[DexaCWT, 0]}
specTran);
}
PredictionResult class:
PredictionResult {
...
public Dictionary<string, double> _predictions { get; set; }
}
Upvotes: 1
Views: 655