public static Task<byte[]> DoSomethingAsync( this IMyService service, string someInputValue) { return Task.Factory.FromAsync( (asyncCallback, asyncState) => service.BeginDoSomething(someInputValue, asyncCallback, asyncState), (asyncResult) => service.EndDoSomething(asyncResult); }