programming language feature idea

Started by
12 comments, last by Ravyne 11 years ago

You mean like this?


var m_sContent = string.Join("\n", sqlreader.Select(x => Compose(x.odID, x.ontorequest, x.wouldLike)));
Or this?

var m_sContent = string.Join("\n", sqlreader.Select(x => string.Format("constblaconstblacnsta{0}ocnstbla{1}asfloaksf{2}constbla", x.odId, x.ontorequest, x.wouldLike)));
Or this?

Func<dynamic,string> compose = x => string.Format("{0} {1} {2}", x.odId, x.ontorequest, x.wouldLike));
var m_sContent = string.Join("\n", sqlreader.Select(compose));
Seriously. C# has got you covered.

Thanks, but it seems too unreadable to me, and my production leaders would not be happy about this habit, plus, I myself am not quite getting it, I think I am getting old :(. Also, the last example seems to be a rather instance of function that gets disposed out of the block, if I am not mistaken, I would rather have possibility to immediately define a function in the scope of the class, so it would not be:
redefintiion able, instance utilized... and so on. Thanks, it seems that this practice is not very common upon programers, and it did not get maintained to level of effective and reasonable usage .

Advertisement

My mistake I posted in Lounge, cannot rate you up, this was very profesional help! Thanks!

Thanks, but it seems too unreadable to me, and my production leaders would not be happy about this habit, plus, I myself am not quite getting it, I think I am getting old sad.png. Also, the last example seems to be a rather instance of function that gets disposed out of the block, if I am not mistaken, I would rather have possibility to immediately define a function in the scope of the class, so it would not be:

redefintiion able, instance utilized... and so on. Thanks, it seems that this practice is not very common upon programers, and it did not get maintained to level of effective and reasonable usage .

It's actually quite common with modern C# programmers. I use lambda's quite frequently.

lambdas like those are increadibly common already, and gaining steam. I would also suggest that any 'production leaders' affraid of a little new syntactic sugar every now and then ought to go back amongst the dinosours and take their stone-age coding practices with them. Lambdas are not just modern fluff, or an odd way of defining functions, they enable one to write the kind of code we always meant to but never did before because it was too verbose.

Anyway, what's the advantage your hypothetical but non-existant approach holds over the new-to-you but here-today one?

throw table_exception("(? ???)? ? ???");

This topic is closed to new replies.

Advertisement