using System; public class RestResponse { } public class RestResponse : RestResponse { public T Data { get; set; } } public static class Client { public static RestResponse Execute() { return new RestResponse(); } public static RestResponse Execute() { return new RestResponse(); } } public class Test { public static void PerformApiCall(Func method) { PerformRequestWithChecks(method); } public static T PerformApiCall(Func> method) { var response = PerformRequestWithChecks>(method); return response.Data; } private static T PerformRequestWithChecks(Func method) where T : RestResponse { var response = method(); // Handle errors... return response; } public static void Main() { // Notice, returns a value var data = PerformApiCall(() => Client.Execute()); // Notice, is the empty version (has no .Data) PerformApiCall(() => Client.Execute()); } }