I assume you have a CastException type error.
Transfer your first object to an object, it should compile:
dynamic prod = vid.HasValue ?
(dynamic)CatalogRepository.GetProductDetailByProductId(pid.Value, vid) :
CatalogRepository.GetProductDetailByProductId(pid.Value);
- , , , .
var s = true ? "s" : 1
var f = true ? 2.0F : 1