rspec/rules/S3217/csharp/comments-and-links.adoc

22 lines
1.1 KiB
Plaintext

=== on 1 Jul 2015, 16:23:11 Ann Campbell wrote:
\[~tamas.vajk] as I was writing this it occurred to me that someone might write this code thinking they were filtering the array (or whatever was being ``++foreach++``ed) so that the inner code would only be called for instances of the derived type.
Am I correct in thinking that we can/should recommend LINQ usage to accomplish that?
=== on 2 Jul 2015, 06:52:37 Tamas Vajk wrote:
\[~ann.campbell.2] Yes, you are right. If the dev wants to filter the list by type, the ``++arr.OfType<Raspberry>()++`` should be used in the ``++foreach++``.
=== on 2 Jul 2015, 12:43:33 Ann Campbell wrote:
Please double-check me [~tamas.vajk]
=== on 2 Jul 2015, 13:44:42 Tamas Vajk wrote:
\[~ann.campbell.2] looks good.
=== on 29 Jul 2015, 11:59:55 Dinesh Bolkensteyn wrote:
Eric Lippert says he implemented this rule on the C# compiler, but then removed it because of the huge amount of false positives in Microsoft's own C# code, so this should be "MAJOR" and "suspicious" at most.
http://ericlippert.com/2013/07/22/why-does-a-foreach-loop-silently-insert-an-explicit-conversion/