|
Thank you for this. I think my confusion comes because I try to read it like mathematical functions e.g. "f: x->x^3"
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
Try reading it as a trimmed down function (which now also allow for an arrow instead of curly braces).
myCollection.Where(bool IsActive(MyObject x) { return x.IsActive; });
myCollection.Where(bool IsActive(MyObject x) => return x.IsActive);
myCollection.Where(bool IsActive(MyObject x) => x.IsActive);
myCollection.Where(bool (MyObject x) => x.IsActive);
myCollection.Where((x) => x.IsActive);
myCollection.Where(x => x.IsActive); It is pretty close to the mathematical notation.
Unfortunately, it doesn't always work that well.
myCollection.Where((x, y) => x.IsActive && y > 10);
myCollection.Where((MyObject x, int y) => x.IsActive && y > 10);
myCollection.Where((collectionItem, index) => collectionItem.IsActive && index > 10); Hope this explains it even further.
|
|
|
|
|
Thank you very much, yes this helps I think
It does not solve my Problem, but it answers my question
modified 19-Jan-21 21:04pm.
|
|
|
|
|
I am not sure it classifies as advanced but I have used unsafe code with casts and pointer arithmetic in C# a lot and am now switching to Span<t>, ref structs and SIMD instructions
|
|
|
|
|
I like to use 'throw' because a 'goto' that allows you to jump out of your current function to some unknown place is just so cool!
I, for one, like Roman Numerals.
|
|
|
|
|
I use C# var extensively (basically C++ auto) in protest of lack of proper typedef support in C#
Real programmers use butterflies
|
|
|
|
|
While I use lambdas in my C# code, I don't consider them especially 'advanced'. Most of the time I'm actually averse to using such features in any language, because they tend to encourage writing clever code rather than maintainable code. Since I have code in the field older than some of you folks reading this, maintainable wins.
I sporadically read news about new C++ features. None of them inspire me, as they whiff strongly of compiler weenies saying "look what I can do!". They are also overly-reliant on templates, and I find the syntax clumsy and verbose. I consider myself well-skilled in C++, and look for productivity-enhancing changes to the language. They're few and far between.
C# is somewhat a different story. Most of the features I read about seem designed to improve productivity and code quality, even when they are dismissed as 'syntactic sugar'.
Software Zen: delete this;
|
|
|
|
|
Writing clever code instead of maintainable---nahh, nobody ever does that.
My own criteria is that I want to be able to look at a section of code and "grok" it in a few seconds.
|
|
|
|
|
I find it interesting that many seem to think 'var' is such a bad thing. In C++, there's the auto keyword, and there's even the complementary keyword decltype which is particularly useful when you want the result type of an expression, or the return type of a function.
As I understand it, auto fills a similar role as var does in other language(s?), and there's actually a coding guideline promoted by Herb Sutter, no less, to 'aaa', or 'almost always [use] auto'. One of the main reasons is to help enforce type safety, which of course is outstandingly important in C++, probably more than in any other language. Another reason is maintainability: every use of auto probably doesn't need to be changed when you change some type in your code later.
That said, I often deliberately don't use auto, for one (or both) of two reasons: helping with autocompletion (the editor sometimes won't know what member variables and methods to suggest when dereferencing an auto variable), readability (provided the type name is easy enough to read, rather than a nested<type>::with<template_arguments>), and disambiguation (when I want the value to remain unchanged - i. e. const - rather than modifiable). I suspect the former will no longer be a reason when we finally manage to switch to a newer IDE version later this year, that's why I said two reasons
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
I agree with Sutter about almost always using auto and will even do this:
const auto& item = ... ;
Another advantage of auto is that there are fewer affected-bys when you rename a type.
Another advantage is that auto reduces the number of line splits, which I like to avoid.
|
|
|
|
|
A slight variation on "that will never happen."
I guess I don't have to explain myself
The customer always does an export at the end of the day, at least according to the customer.
They can't even not do it because their business depends on it.
Needless to say, that's not how they work at all and I just got a month worth of exports all at once
Of course, my code can't handle this because of reasons (mostly because of a ridiculously complicated pre-XML format that I have to use).
The project is over budget and I can't spend any more hours on it.
Sometimes I think I've chosen the wrong profession
|
|
|
|
|
If they told you a daily export was mandatory, and you can prove it is not the case, then maybe you have some leverage because original agreement was broken?
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
We're going to try and make the supplier of the export fix this.
If they export a separate file per date, even when there's x dates, it's fixed too
|
|
|
|
|
My experience: When a customer says "never", it happens about 5% of the time.
|
|
|
|
|
Terry Pratchett said (in Discworld) that when something is a one-in-a-million chance, it occurs nine times out of ten.
Freedom is the freedom to say that two plus two make four. If that is granted, all else follows.
-- 6079 Smith W.
|
|
|
|
|
When a customer says "never" I'm about 95% sure it'll happen.
I was pretty sure the "always" part was a bit exaggerated as well
|
|
|
|
|
Yes, there is a translation step necessary when dealing with customers and those terms. Never means more like in around 10% of cases. Always is more like 75% of cases. Exceptions are definitely the rule.
"They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"
|
|
|
|
|
|
Sander Rossel wrote: Sometimes I think I've chosen the wrong profession Like I've always said: plumbing is the best job, because there's at least a good reason why you're up to your neck in sh1t.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Allow a penalty perhaps? (8)
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Nice one but quick question, What is the significance of ? in a CCC
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
|
Just visited the 'About us' page and realized why Bob is such an excellent member... Bob holds a spanner in one hand and a glass of beer in the other...
We should learn from the best!!!
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
modified 20-Jan-20 2:42am.
|
|
|
|
|
A glass of Bear? That explains why they abduct animals, I guess.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I was probably thinking of the upcoming snow...
"The only place where Success comes before Work is in the dictionary." Vidal Sassoon, 1928 - 2012
|
|
|
|