I just made an utterly silly logical error in this code. What is it? (This is not a performance question, this code is simply wrong.)
Your email address will not be published. Required fields are marked *
Notify me of followup comments via e-mail
Save my name, email, and website in this browser for the next time I comment.
Δ
Milyen az az UserId kapacitású új lista ? :-)
Inkább ez:
.Except(new int[] { _userContext.UserId }).ToList()
vagy ez
.Except(new List() { _userContext.UserId }).ToList()
Na, a List()-emből lemaradt a generikus . Képzeljétek oda. :-)
Jó válasz. :) Én new List() {_userContext.UserId }-t használnék, nem kell a tömb feleslegesen.
Megsúgom, a List<T> belül is egy tömb. :-)
Persze, de csinálni egy tömböt, majd ToList()-elni rajta, az dupla allokálás.
LEAVE A COMMENT
5 COMMENTS
Milyen az az UserId kapacitású új lista ? :-)
Inkább ez:
.Except(new int[] { _userContext.UserId }).ToList()
vagy ez
.Except(new List() { _userContext.UserId }).ToList()
Na, a List()-emből lemaradt a generikus . Képzeljétek oda. :-)
Jó válasz. :)() {_userContext.UserId }-t használnék, nem kell a tömb feleslegesen.
Én new List
Megsúgom, a List<T> belül is egy tömb. :-)
Persze, de csinálni egy tömböt, majd ToList()-elni rajta, az dupla allokálás.