Skip to main content
deleted 40 characters in body
Source Link
Denis
  • 8.5k
  • 5
  • 31
  • 76
  • You don't really need the EventHandler you can just replace boardButtons[x, y].Click += click; withboardButtons[x, y].Click += btn_Click;. This is called anonymous event handler. The += already works with delegates and kinda does that for you.

  • The only time you want to have this is when your method parameters have the same names as your class variables it appears that's not case for you, because I don't see any of the variables used without it.

Overall I really don't see what you can improve, you are simply assigning some values to some variables which really cant be speed up. Windows forms isn't really good for many controls at once that's it.

  • You don't really need the EventHandler you can just replace boardButtons[x, y].Click += click; withboardButtons[x, y].Click += btn_Click;. This is called anonymous event handler. The += already works with delegates and kinda does that for you.

  • The only time you want to have this is when your method parameters have the same names as your class variables it appears that's not case for you, because I don't see any of the variables used without it.

Overall I really don't see what you can improve, you are simply assigning some values to some variables which really cant be speed up. Windows forms isn't really good for many controls at once that's it.

  • You don't really need the EventHandler you can just replace boardButtons[x, y].Click += click; withboardButtons[x, y].Click += btn_Click;. The += already works with delegates and kinda does that for you.

  • The only time you want to have this is when your method parameters have the same names as your class variables it appears that's not case for you, because I don't see any of the variables used without it.

Overall I really don't see what you can improve, you are simply assigning some values to some variables which really cant be speed up. Windows forms isn't really good for many controls at once that's it.

added 40 characters in body
Source Link
Denis
  • 8.5k
  • 5
  • 31
  • 76
  • You don't really need the EventHandler you can just replace boardButtons[x, y].Click += click; withboardButtons[x, y].Click += btn_Click;. This is called anonymous event handler. The += already works with delegates and kinda does that for you.

  • The only time you want to have this is when your method parameters have the same names as your class variables it appears that's not case for you, because I don't see any of the variables used without it.

Overall I really don't see what you can improve, you are simply assigning some values to some variables which really cant be speed up. Windows forms isn't really good for many controls at once that's it.

  • You don't really need the EventHandler you can just replace boardButtons[x, y].Click += click; withboardButtons[x, y].Click += btn_Click;. The += already works with delegates and kinda does that for you.

  • The only time you want to have this is when your method parameters have the same names as your class variables it appears that's not case for you, because I don't see any of the variables used without it.

Overall I really don't see what you can improve, you are simply assigning some values to some variables which really cant be speed up. Windows forms isn't really good for many controls at once that's it.

  • You don't really need the EventHandler you can just replace boardButtons[x, y].Click += click; withboardButtons[x, y].Click += btn_Click;. This is called anonymous event handler. The += already works with delegates and kinda does that for you.

  • The only time you want to have this is when your method parameters have the same names as your class variables it appears that's not case for you, because I don't see any of the variables used without it.

Overall I really don't see what you can improve, you are simply assigning some values to some variables which really cant be speed up. Windows forms isn't really good for many controls at once that's it.

Source Link
Denis
  • 8.5k
  • 5
  • 31
  • 76

  • You don't really need the EventHandler you can just replace boardButtons[x, y].Click += click; withboardButtons[x, y].Click += btn_Click;. The += already works with delegates and kinda does that for you.

  • The only time you want to have this is when your method parameters have the same names as your class variables it appears that's not case for you, because I don't see any of the variables used without it.

Overall I really don't see what you can improve, you are simply assigning some values to some variables which really cant be speed up. Windows forms isn't really good for many controls at once that's it.