[OT] C# -- sharp or carp? was Re: Learning Python (or Haskell) makes you a worse programmer
Sven R. Kunze
srkunze at mail.de
Tue Mar 29 11:41:34 EDT 2016
On 29.03.2016 12:18, Sven R. Kunze wrote:
> On 29.03.2016 11:39, Peter Otten wrote:
>> My question to those who know a bit of C#: what is the state-of-the-art
>> equivalent to
>>
>> "\n".join(foo.description() for foo in mylist
>> if foo.description() != "")
>>
>
> Using LINQ, I suppose:
> https://en.wikipedia.org/wiki/Language_Integrated_Query
Friend of mine told me something like this:
String.Join("\n", mylist.Where(foo =>
!String.IsNullOrEmpty(foo.description)).Select(foo => foo.description))
[untested, but from what I know of quite correct]
Best,
Sven
More information about the Python-list
mailing list