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 05-05-2021

    The world's biggest jeweller, Pandora, says it will no longer sell mined diamonds and will switch to exclusively laboratory-made diamonds (tags:…

  • Interesting Links for 04-05-2021

    What if Uber - but superheroes? (tags: superheroes business roleplaying ) Biden at 100 Days: Boring as a Secret Weapon (tags: politics usa )…

  • Interesting Links for 03-05-2021

    UK sends 1,000 ventilators to Covid-stricken India but pressure grows to let it keep vaccines (tags: India pandemic vaccination UK ) Some…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 34 comments

  • Interesting Links for 05-05-2021

    The world's biggest jeweller, Pandora, says it will no longer sell mined diamonds and will switch to exclusively laboratory-made diamonds (tags:…

  • Interesting Links for 04-05-2021

    What if Uber - but superheroes? (tags: superheroes business roleplaying ) Biden at 100 Days: Boring as a Secret Weapon (tags: politics usa )…

  • Interesting Links for 03-05-2021

    UK sends 1,000 ventilators to Covid-stricken India but pressure grows to let it keep vaccines (tags: India pandemic vaccination UK ) Some…