Example #1
0
 bool changeVars(ref Response r, decimal v)
 {
     try
     {
         var t = r.GetType();
         foreach (var pi in t.GetProperties())
             if (pi.Name == OptimizeName)
             {
                 if (pi.PropertyType == typeof(int))
                 {
                     pi.SetValue(r, (int)v, null);
                 }
                 else
                     pi.SetValue(r, v, null);
                 return true;
             }
     }
     catch (Exception ex)
     {
         debug("error setting parameter " + OptimizeName + " on response: " + r.FullName + " to: " + v+" err: "+ex.Message+ex.StackTrace);
     }
     return false;
 }