戻り値の型がIEnumerable<T>
のいくつかのメソッドがあります。これらのメソッドは、DomainService
クラスの一部であり、クライアント上で、彼らはこれらのメソッドを呼び出すときに、コールバックのコードは基本的に同じDRY(リファクタリング)コールバックを使用するこのコードですか?
void SomeMethodA(string someString, Action<ResultsArgs<string>> operationCompleted)
{
MyContext.MethodA(someString, c =>
{
// same code (operationCompleted parameter is used)
}, null);
}
void SomeMethodA(Action<ResultsArgs<string>> operationCompleted)
{
MyContext.MethodB(c =>
{
// same code (operationCompleted parameter is used)
}, null);
}
あるInvokeOperation<T>
public InvokeOperation<IEnumerable<T>> MethodA(string prm, Action<InvokeOperation<IEnumerable<T>>>
public InvokeOperation<IEnumerable<T>> MethodB(Action<InvokeOperation<IEnumerable<T>>>
の戻り値の型で生成され、これをリファクタリングしてコードが重複しないようにすることはできますか?