Property | Value |
---|---|
Id | RCS1077 |
Category | Performance |
Severity | Info |
bool any = items.Where(predicate).Any(); // RCS1077
bool any = items.Any(predicate);
int max = items.Select(selector).Max(); // RCS1077
int max = items.Max(selector);
IEnumerable<Foo> x = items.Where(f => f is Foo).Cast<Foo>(); // RCS1077
IEnumerable<Foo> x = items.OfType<Foo>();
bool x = items.Where((f) => Foo1(f)).Any(f => Foo2(f)); // RCS1077
bool x = items.Any((f) => Foo1(f) && Foo2(f));
IEnumerable<object> x = items.Select(f => (object)f); // RCS1077
IEnumerable<object> x = items.Cast<object>();
bool x = items.FirstOrDefault((f) => Foo(f)) != null; // RCS1077
bool x = items.Any((f) => Foo(f));
bool x = items.FirstOrDefault() != null; // RCS1077
bool x = items.Any();
var x = list.ElementAt(1); // RCS1077
var x = list[1];
var x = list.First(); // RCS1077
var x = list[0];
if (enumerable.Count() != 0) // RCS1077
{
}
if (enumerable.Any())
{
}
if (list.Count() == 1) // RCS1077
{
}
if (list.Count == 1)
{
}
var stack = new Stack<object>();
// ...
object x = stack.First(); // RCS1077
var stack = new Stack<object>();
// ...
object x = items.Peek();
var queue = new Queue<object>();
// ...
object x = stack.First(); // RCS1077
var queue = new Queue<object>();
// ...
object x = items.Peek();
enumerable.Any() ? enumerable.First() : default // RCS1077
enumerable.FirstOrDefault()
enumerable.OrderBy(f => f).Reverse() // RCS1077
enumerable.OrderByDescending()
enumerable.SelectMany(f => f.Items).Count() // RCS1077
enumerable.Sum(f => f.Items.Count)
(Generated with DotMarkdown)