Skip to content

Add generic counterparts for TryResolveNamed, TryResolveKeyed and TryResolveService #1263

@lukoerfer

Description

@lukoerfer

Problem Statement

The static class ResolutionExtensions provides a set of extension methods to manually resolve instances from a container. Some of these methods (e.g. Resolve and TryResolve) have a generic counterpart (Resolve<T> and TryResolve<T>), but others, namely TryResolveNamed, TryResolveKeyed and TryResolveService, dont.

Desired Solution

The generic counterparts could just call the non-generic extension methods and then cast the out parameter in the same way as the generic version TryResolve.

Alternatives You've Considered

Right know, one can either write their own extension methods or use other workarounds (e.g. resolve IIndex<string, T> and use TryGetValue as an alternative to TryResolveNamed).

Additional Context

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions