Reputation
Top tag
Next privilege 200 Rep.
See reduced ads
Badges
8
Impact
~1k people reached

  • 0 posts edited
  • 0 helpful flags
  • 5 votes cast
Jan
26
awarded  Popular Question
Oct
28
comment Two HTML elements with same id attribute: How bad is it really?
@yoniLavi updated.
Oct
28
revised Two HTML elements with same id attribute: How bad is it really?
added reference
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?