Skip to content

Instantly share code, notes, and snippets.

@ABaker86
Created January 16, 2020 01:35
Show Gist options
  • Save ABaker86/090a20f0e40fa4de8b2eea76149cf018 to your computer and use it in GitHub Desktop.
Save ABaker86/090a20f0e40fa4de8b2eea76149cf018 to your computer and use it in GitHub Desktop.
Update control using Action to keep code DRY
Action<Label, string, Point, Font> Up => (l, s, p, f) =>
{
l.Text = s;
l.Size = new Size(p);
l.Font = f;
};
void UpdateLblOne() => Up(lblOne, TEXT, SIZE, FONT);
void UpdateLblTwo() => Up(label2, TEXT, SIZE, FONT);
private void Form1_Load(object sender, EventArgs e)
{
UpdateLblOne();
UpdateLblTwo();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment