Microsoft Unityを利用するフレームワークにカスタムビジネスロジックを挿入するために、インターフェイスを実装しています。私の主な問題は、実装する必要のあるインターフェイスが次のメソッドを定義していることです。
T InterfaceMethod<T>();
T
制約はありません。私のコードでは、別のサードパーティライブラリからメソッドを呼び出す必要があります。メソッドシグネチャは次のとおりです。
T AnotherMethod<T>() where T: class;
タイプTは、のロジックにとって重要ですAnotherMethod
。AnotherMethod<T>()
リフレクションを使用せずに、実装内で呼び出す方法はありますか?T
が値型の場合は、明らかに別のアクションを実行する必要があります。これを回避するためにオートボックス化する方法はおそらくありますか?