private static List<SqlParameter> crearLista(clsUnidadProductoraServicio objUnidadProductoraServicio) { List<SqlParameter> lstParametrosSQL = new List<SqlParameter>(); SqlParameter sqlParametro; foreach (PropertyInfo pi in objUnidadProductoraServicio.GetType().GetProperties()) { if (pi.CanRead) { sqlParametro = new SqlParameter(); sqlParametro.ParameterName = "@" + pi.Name; sqlParametro.Value = pi.GetValue(objUnidadProductoraServicio, null); sqlParametro.Direction = ParameterDirection.Input; lstParametrosSQL.Add(sqlParametro); } } return lstParametrosSQL; }