Implementing a Code Action using Roslyn
Posted by: C# Frequently Asked Questions,
on 06 Feb 2012 |
View original | Bookmarked: 0 time(s)
By Brian Rasmussen
The Roslyn Services API makes it easy to implement extensions that detect and fix code issues directly in Visual Studio. The Roslyn Services API is available as part of the Roslyn CTP.
In this post we implement a Visual Studio extension that identifies calls to the extension method Count() on Enumerable, where the result is compared to greater than zero, e.g. someSequence.Count() > 0. The problem, with that code construct, is that Count() may have to enumerate the entire...