Trump reveals what he really thinks about Jeff Bezos after declaring WAR on billionaire over Amazon tariffs
You've been making pasta wrong! Scientists reveal the ultimate recipe for Cacio e pepe - and why you should NEVER use pasta water
Meghan Markle criticised for bedtime ritual for Archie and Lili - as people say it's not believable
AWS creates EC2 instance types tailored for demanding on-prem workloads
Amazon Web services has created new elastic compute cloud instance types for its on-prem Outposts racks, the second generation of which was announced on Tuesday.…
Blake Lively and Ryan Reynolds put on a brave face as they step out amid ANOTHER Justin Baldoni bombshell
Spain and why energy security's being sacrificed on the altar of green dogma: RUPERT DARWALL
HMRC is a 'lumbering dinosaur' say MPs who call on tax office to start using AI
Wisconsin judge Hannah Dugan suffers humiliating blow after arrest by FBI for helping illegal migrant 'evade arrest'
How to make thousands selling your old clothes on Vinted: Secrets of the sellers who have turned huge profits - and the mistakes to avoid
Free speech row as cartoons are banned: Backlash after venue scraps exhibition of Fleet Street cartoonists - including the Mail's Mac and Pugh - for fear of causing offence
Meet the 'LATers' having better sex than you: Couples who 'Live Apart Together' tell TRACEY COX why separate homes have spiced things up in the bedroom
Dramatic moment Paul Hollywood swooped in on his helicopter to rescue stricken pilot who crashed his aircraft into farmer's field
'We must avoid sleepwalking into situation where cash is no longer accepted' MPs warn
Olivia Colman shocks with her choice of crumpet topping as she is the latest Hollywood star to appear in a Warburtons advert
After 53 Years, a Failed Soviet Venus Spacecraft Is Crashing Back to Earth
Read more of this story at Slashdot.
Jennifer Garner appears to make thinly-veiled dig at Blake Lively in resurfaced clip
CodeSOD: Find the First Function to Cut
Sebastian is now maintaining a huge framework which, in his words, "could easily be reduced in size by 50%", especially because many of the methods in it are reinvented wheels that are already provided by .NET and specifically LINQ.
For example, if you want the first item in a collection, LINQ lets you call First() or FirstOrDefault() on any collection. The latter option makes handling empty collections easier. But someone decided to reinvent that wheel, and like so many reinvented wheels, it's worse.
public static LoggingRule FindFirst (this IEnumerable<LoggingRule> rules, Func<LoggingRule, bool> predicate) { foreach (LoggingRule rule in rules) { return rule; } return null; }This function takes a list of logging rules and a function to filter the logging rules, starts a for loop to iterate over the list, and then simply returns the first element in the list, thus exiting the for loop. If the loop doesn't contain any elements, we return null.
From the signature, I'd expect this function to do filtering, but it clearly doesn't. It just returns the first element, period. And again, there's already a built-in function for that. I don't know why this is exists, but I especially dislike that it's so misleading.
There's only one positive to say about this: if you did want to reduce the size of the framework by 50%, it's easy to see where I'd start.