Advertisement
Guest User

ReSharper StructuredSearch QuciFixes Robbe

a guest
Jun 16th, 2011
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.10 KB | None | 0 0
  1. <CustomPatterns>
  2.   <Pattern Severity="WARNING">
  3.     <Comment>Maybe not intended object identity comparision use object.Equals instead.</Comment>
  4.     <ReplaceComment>replace with object.Equals()</ReplaceComment>
  5.     <ReplacePattern>object.Equals( $objex$, $objeder$ )</ReplacePattern>
  6.     <SearchPattern><![CDATA[$objex$ == $objeder$
  7. ]]></SearchPattern>
  8.     <Params />
  9.     <Placeholders>
  10.       <ExpressionPlaceholder Name="objex" ExpressionType="System.Object" ExactType="True" />
  11.       <ExpressionPlaceholder Name="objeder" ExpressionType="System.Object" ExactType="False" />
  12.     </Placeholders>
  13.   </Pattern>
  14.   <Pattern Severity="HINT">
  15.     <Comment>As cast + if==null to static cast</Comment>
  16.     <ReplaceComment>to static cast</ReplaceComment>
  17.     <ReplacePattern><![CDATA[var $var$ = ($type$)$objex$;
  18. $block$]]></ReplacePattern>
  19.     <SearchPattern><![CDATA[$type$ $var$ = $objex$ as $type$;
  20. if( $var$ != null )
  21. {
  22.  $block$
  23. }
  24. ]]></SearchPattern>
  25.     <Params />
  26.     <Placeholders>
  27.       <ExpressionPlaceholder Name="objex" ExpressionType="" ExactType="False" />
  28.       <IdentifierPlaceholder Name="var" Type="" ExactType="False" RegEx="" CaseSensitive="True" />
  29.       <StatementPlaceholder Name="block" Minimal="1" Maximal="-1" />
  30.       <TypePlaceholder Name="type" Type="" ExactType="True" />
  31.     </Placeholders>
  32.   </Pattern>
  33.   <Pattern Severity="HINT">
  34.     <Comment>Static cast can be written as "as-Cast with if==null"</Comment>
  35.     <ReplaceComment>to "as-Cast mit if==null"</ReplaceComment>
  36.     <ReplacePattern><![CDATA[$type$ $var$ = $objex$ as $type$;
  37. if( $var$ != null )
  38. {
  39.  $block$
  40. }
  41. ]]></ReplacePattern>
  42.     <SearchPattern><![CDATA[var $var$ = ($type$)$objex$;
  43. $block$
  44. ]]></SearchPattern>
  45.     <Params />
  46.     <Placeholders>
  47.       <ExpressionPlaceholder Name="objex" ExpressionType="" ExactType="True" />
  48.       <IdentifierPlaceholder Name="var" Type="" ExactType="False" RegEx="" CaseSensitive="True" />
  49.       <StatementPlaceholder Name="block" Minimal="1" Maximal="-1" />
  50.       <TypePlaceholder Name="type" Type="" ExactType="True" />
  51.     </Placeholders>
  52.   </Pattern>
  53. </CustomPatterns>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement