Advertisement
Guest User

Untitled

a guest
Feb 19th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. var attr1 = new ItemTemplateAttribute();
  2. var attr2 = new ItemTemplateAttribute();
  3.  
  4. var assign_bounds1 = new List<Action<int>>() {
  5.     x => attr1.lower_min = x, x => attr1.lower_max = x, x => attr1.upper_min = x, x => attr1.upper_max = x
  6. };
  7.  
  8. var assign_bounds2 = new List<Action<int>>() {
  9.     x => attr2.lower_min = x, x => attr2.lower_max = x, x => attr2.upper_min = x, x => attr2.upper_max = x
  10. };
  11.  
  12. for(int i=0; i < 4; ++i)
  13. {
  14.     Func<int, int> selector = id => Convert.ToInt32(
  15.         new MySqlCommand(String.Format(format, attr_name, bound_names[i], id), m_form.Connection)
  16.         .ExecuteScalar()
  17.     );
  18.     assign_bounds1[i](ids1.Select(selector).Sum());
  19.     assign_bounds2[i](ids2.Select(selector).Sum());
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement