Extract the type of expression with Resharper structural replace
-
12-10-2022 - |
문제
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?
올바른 솔루션이 없습니다
제휴하지 않습니다 StackOverflow