More fluent C# / .NET

后端 未结 21 1284
名媛妹妹
名媛妹妹 2020-12-23 22:51

A co-worker of mine came up with this and I wonder what others think? Personally, I find it interesting but wonder if it is too big a departure? Code examples below. Extensi

21条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-23 23:55

    I'd say stick with the first version. What you've posted is too clever to be immediately useful to someone reading the code.

    You could even go a step further and do away with that "var":

    DropDownList ddl = (DropDownList) Page.FindControl("ddlName");
    

提交回复
热议问题