130 reputation
7
bio website bartmax.com
location Uruguay
age 34
visits member for 2 years, 11 months
seen Dec 2 at 18:39

UX, HTML CSS & Javascript SEO-aware Ninja.


Oct
6
awarded  Student
Aug
16
comment Is it bad idea to use flag variable to search MAX element in array?
why not use (or see source code) of LINQ source.Max() ?
Aug
16
awarded  Commentator
Aug
15
comment There's a most performant way to check that a collection has exactly 1 element?
Isn't that exactly what IEnumerable.Count() does?
Aug
15
comment There's a most performant way to check that a collection has exactly 1 element?
@Euphoric can you provide an example?
Aug
15
revised There's a most performant way to check that a collection has exactly 1 element?
added 329 characters in body
Aug
15
revised There's a most performant way to check that a collection has exactly 1 element?
added 12 characters in body
Aug
15
revised There's a most performant way to check that a collection has exactly 1 element?
added 392 characters in body
Aug
15
comment There's a most performant way to check that a collection has exactly 1 element?
@JK01 it's an extension method that can (and will) be used intensively/freely on a big application so performance can be an issue when running it multiple times with lots of request per second.
Aug
15
comment There's a most performant way to check that a collection has exactly 1 element?
@Snowman I'm pretty sure that MoveNext() it's optimized for all collections. Any particular collection you think I should test for Count vs MoveNext ?
Aug
15
comment There's a most performant way to check that a collection has exactly 1 element?
@JK01 I didn't know but run some test and with 40,000 elements, with count it takes 00.0004618 while with the solution with MoveNext only takes 00.0000067. With 2 elemnts 3169 vs 0011 and with 1 elements it's the same. As bigger the collection, count gets slower.
Aug
15
awarded  Scholar
Aug
15
comment There's a most performant way to check that a collection has exactly 1 element?
Skip 1 not any wont work either. False on 2+ and True on 0 and 1.
Aug
15
revised There's a most performant way to check that a collection has exactly 1 element?
added 255 characters in body
Aug
15
comment There's a most performant way to check that a collection has exactly 1 element?
.Skip(1).Any() will not work because it will return true when collection have 2+ elements and false on 1 or 0 elements.
Aug
15
comment There's a most performant way to check that a collection has exactly 1 element?
makes lot of sense. Can you provide me a naive example ? Not familiar with yield.
Aug
15
asked There's a most performant way to check that a collection has exactly 1 element?
Apr
3
comment Two HTML elements with same id attribute: How bad is it really?
It's not out of the standard because the standard specify what to do in those situations. So no, getElementById could not return any element, the standard says explicit that i will return the first match. I agree that behaviour out of the standard is undefined, what you don't understand is that all those cases are part of the standard.
Feb
23
awarded  Supporter
Dec
29
awarded  Editor