public IAsyncResult BeginGet <T>(string cls, string id, ProtoAPIGetCallback <T> callback) { if (string.IsNullOrEmpty(cls) || string.IsNullOrEmpty(id)) { throw new ProtoAPIException("Invalid parameters: AsyncGet cannot be completed"); } CheckUserAndAppKey(); ResponseStatus <T> response_status = new ResponseStatus <T>(); ManualResetEvent finished_event = new ManualResetEvent(false); RESTAsyncResult async_result = new RESTAsyncResult(finished_event, response_status); RESTClient client = new RESTClient(m_ServiceUri); client.SetBasicAuthorizationCredential(m_username, m_appkey); client.AsyncGet("objects/" + cls + "/" + id, null, delegate(int status, string response){ response_status.statusCode = status; if (status >= 200 && status < 300) { JsonResponseObject <T> data_wrapper; data_wrapper = JsonConvert.DeserializeObject <JsonResponseObject <T> >(response, new IsoDateTimeConverter()); response_status.responseData = data_wrapper.data; if (null != callback) { callback(response_status, data_wrapper.data); } } else { response_status.responseData = response; response_status.errorMessage = response; if (null != callback) { callback(response_status, default(T)); } } async_result.SetCompleted(); }); return(async_result); }