Determining return type in an expression

Take the following code for example:

using (var timeoutCts = new CancellationTokenSource())
using (var kancel = CancellationTokenSource
    .CreateLinkedTokenSource(timeoutCts.Token, cancel))

I want to locate the construction of all IDisposable objects.

new $disp$($args$)

where disp is IDisposable.

$disp$ $var$ = $exp$;

where disp is IDisposable

These pick up many, but do not pick up the returned object of CreateLinkedTokenSource, which is disposable.

If I was to just write:

CancellationTokenSource.CreateLinkedTokenSource(timeoutCts.Token, cancel);

it would seem I have no way to detect it unless there's a way to check return types. So my question is, is there a way to determine if something returns an IDisposable in ReSharper?

Bonus points: is there a link to a definition of this syntax or a way to express "Placeholders" that's not with a list/dialog?

Please sign in to leave a comment.