CodePaste Logo
New Snippet New Recent Snippets Recent Snippets My Snippets My Snippets My Favorites Favorites Web Code Search Snippets Search
Sign inor Register
Language: xml

ReSharper 5.0: Structural Search and Replace

918 Views   
<CustomPatterns> <Pattern Severity="SUGGESTION"> <Comment>Use method Any()</Comment> <ReplacePattern>$seq$.Any()</ReplacePattern> <SearchPattern><![CDATA[$seq$.Count() > 0]]></SearchPattern> <Params /> <Placeholders> <ExpressionPlaceholder Name="seq" ExpressionType="System.Collections.IEnumerable" ExactType="False" /> </Placeholders> </Pattern> <Pattern Severity="SUGGESTION"> <Comment>Replace with ternary operator</Comment> <ReplacePattern>$x$ = $condition$ ? $expr1$ : $expr2$;</ReplacePattern> <SearchPattern><![CDATA[if ($condition$) { $x$ = $expr1$; } else { $x$ = $expr2$; }]]></SearchPattern> <Params /> <Placeholders> <ExpressionPlaceholder Name="condition" ExpressionType="System.Boolean" ExactType="False" /> <IdentifierPlaceholder Name="x" Type="" ExactType="False" RegEx="" CaseSensitive="True" /> <ExpressionPlaceholder Name="expr1" ExpressionType="" ExactType="True" /> <ExpressionPlaceholder Name="expr2" ExpressionType="" ExactType="True" /> </Placeholders> </Pattern> </CustomPatterns>
by Jon Erickson
  April 07, 2010 @ 8:51am
Tags:
Description:
http://blogs.jetbrains.com/dotnet/2010/04/introducing-resharper-50-structural-search-and-replace/#comment-312022
Add a comment


Report Abuse
brought to you by:
West Wind Techologies