shorter way of writing x => x.Length()
I thought you could just put string.Length? but you apparently cant? is there no way to write it shorter?
28 Replies
context?
LINQ
.Min
oh, you mean Method group syntax
names.Min<string>(x => x.Length())
like cant i do the lambda shorter
since
Length
is a property, not a method, thats not availableCount
:trollface:i thought it was a method
how do i even see if its a method or a property
by using your eyes
i hate the c# naming conventions
🙂
i dont see the source tho
it looks exactly the same as a method
ye i dont see that
so there is no way to write this shorter then?
no
also.. why?
x => x
isnt that longits ugly
its important
you dont have intellisense?
You can technically write
Enumerable.Count
, does have some overhead but should not actually iterate the entire str. Also I'd never do that...idk my rider seems to not work rn
then fix your rider
coding without intellisense is just making your life harder for no reason
Idk... I'd just write the latter
ye i know i will fix it
well its fine i jsut thought there would be the shorter way of writing it
embrace the lambda. learn to love it
You can also write your own method if you write it that many times... Like
But generally only if this is local to a class of yours or something, definitely do not put this in some shared context, that's confusing and Pythonic af
invalidate caches and restart, that tends to fix the editor being drunk for me