質問

I am trying to make a R# structural search and replace to offer the following

foo.ToList()

should be converted to the below if the user selects the refactoring

foo as List<int> ?? foo.ToList()

so in R# I would try for the pattern

$expr$.ToList()

and for the replace

$expr$ as List<$type$> ?? $expr$.ToList()

however I can't figure out how I could assign $type$ where

typeof($expr$) is IEnumerable<$type$> 

In theorey it should work because I can constrain $expr$ to be of type IEnumerable<T> but I don't have $T$ available as a replace token.

Is this in way at all possible?

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top