Andrew Ducker (andrewducker) wrote,
Andrew Ducker
andrewducker

Syntax I'd like to use.

Given a particular case I need to make four contols invisible.

I can just say:
control1.visible = false;
control2.visible = false;
label1.visible = false;
label2.visible = false;
but it seems awfully longwinded.

You can shorten it a bit to:
control1.Visible = control2.Visible = label1.Visible = label2.Visible = false;
but that's pretty awkward to read, and has redundancy too.

I think that C# lambda functionality would allow me to end up with code something like:
{label1,label2, control1,control2}.Set(Control c => c.visible=false;)
but that also seems pretty clunky (I can't check that syntax at work, we're using VS 2005, which doesn't support lambdas).

Is there a language that would let you do this?:
{label1,label2, control1,control2}.Visible = false;
Subscribe

  • Interesting Links for 27-02-2021

    Covid in Scotland: 40-49 next to be vaccinated (including me!) (tags: vaccination Scotland pandemic age ) Cairngorms recreated in Minecraft…

  • Interesting Links for 26-02-2021

    Why do video games matter? 20 books every player should read (tags: games books ) Trying to weed out the good criticisms of Scott…

  • The week of 1.5 children

    After five days of being back at nursery Sophia still complains that she has to go, but the complaint lasts about three seconds and is mollified by…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 34 comments

  • Interesting Links for 27-02-2021

    Covid in Scotland: 40-49 next to be vaccinated (including me!) (tags: vaccination Scotland pandemic age ) Cairngorms recreated in Minecraft…

  • Interesting Links for 26-02-2021

    Why do video games matter? 20 books every player should read (tags: games books ) Trying to weed out the good criticisms of Scott…

  • The week of 1.5 children

    After five days of being back at nursery Sophia still complains that she has to go, but the complaint lasts about three seconds and is mollified by…