PropertyInfo GetValue() Object does not match target type
c#, types
Solution
You should pass the instance of `TEditDTO` to `GetValue` method not the type instance.
var Id = prop.GetValue(editedDTO);
Problem
I want to read value of a T type ``` public virtual ActionResult Edit(TEditDTO editedDTO) { if (!ModelState.IsValid) return View(editedDTO); var t = editedDTO.GetType(); var prop = t.GetProperty("Id") ; var Id = prop.GetValue(t); // get exception } ``` but get Object does not match target type