Click here to Skip to main content
15,892,927 members
Home / Discussions / C#
   

C#

 
AnswerRe: The name does not exist in the current context Pin
Richard MacCutchan11-Nov-20 23:03
mveRichard MacCutchan11-Nov-20 23:03 
AnswerRe: The name does not exist in the current context Pin
OriginalGriff11-Nov-20 23:06
mveOriginalGriff11-Nov-20 23:06 
QuestionHow to find days between a defined date and now? Pin
Alex Dunlop10-Nov-20 7:51
Alex Dunlop10-Nov-20 7:51 
AnswerRe: How to find days between a defined date and now? Pin
Richard MacCutchan10-Nov-20 8:56
mveRichard MacCutchan10-Nov-20 8:56 
GeneralRe: How to find days between a defined date and now? Pin
Alex Dunlop10-Nov-20 16:48
Alex Dunlop10-Nov-20 16:48 
GeneralRe: How to find days between a defined date and now? Pin
Richard MacCutchan10-Nov-20 21:57
mveRichard MacCutchan10-Nov-20 21:57 
AnswerRe: How to find days between a defined date and now? Pin
Gerry Schmitz10-Nov-20 14:51
mveGerry Schmitz10-Nov-20 14:51 
GeneralRe: How to find days between a defined date and now? Pin
Alex Dunlop10-Nov-20 16:57
Alex Dunlop10-Nov-20 16:57 
GeneralRe: How to find days between a defined date and now? Pin
Gerry Schmitz10-Nov-20 18:11
mveGerry Schmitz10-Nov-20 18:11 
AnswerRe: How to find days between a defined date and now? Pin
Mycroft Holmes11-Nov-20 11:12
professionalMycroft Holmes11-Nov-20 11:12 
QuestionJSON "classes" repetitive Pin
Member 56973910-Nov-20 6:25
Member 56973910-Nov-20 6:25 
AnswerRe: JSON "classes" repetitive Pin
Gerry Schmitz10-Nov-20 7:24
mveGerry Schmitz10-Nov-20 7:24 
GeneralRe: JSON "classes" repetitive Pin
Member 56973910-Nov-20 8:06
Member 56973910-Nov-20 8:06 
GeneralRe: JSON "classes" repetitive Pin
Gerry Schmitz10-Nov-20 14:33
mveGerry Schmitz10-Nov-20 14:33 
QuestionColor the intersected rectangles in c# windows applicaion Pin
Member 147377589-Nov-20 19:47
Member 147377589-Nov-20 19:47 
AnswerRe: Color the intersected rectangles in c# windows applicaion Pin
OriginalGriff9-Nov-20 20:12
mveOriginalGriff9-Nov-20 20:12 
QuestionLINQ results getting modified? Pin
Stellar Developer9-Nov-20 13:52
Stellar Developer9-Nov-20 13:52 
AnswerRe: LINQ results getting modified? Pin
Gerry Schmitz9-Nov-20 14:49
mveGerry Schmitz9-Nov-20 14:49 
GeneralRe: LINQ results getting modified? Pin
Stellar Developer9-Nov-20 15:56
Stellar Developer9-Nov-20 15:56 
GeneralRe: LINQ results getting modified? Pin
Gerry Schmitz9-Nov-20 23:43
mveGerry Schmitz9-Nov-20 23:43 
SuggestionRe: LINQ results getting modified? Pin
Richard Deeming9-Nov-20 21:58
mveRichard Deeming9-Nov-20 21:58 
QuestionWhat's Wrong With This??? Pin
Kevin Marois8-Nov-20 19:00
professionalKevin Marois8-Nov-20 19:00 
AnswerRe: What's Wrong With This??? Pin
Jörgen Andersson8-Nov-20 20:11
professionalJörgen Andersson8-Nov-20 20:11 
AnswerRe: What's Wrong With This??? Pin
Richard Deeming8-Nov-20 21:47
mveRichard Deeming8-Nov-20 21:47 
Ignoring the Task, since this is an async method, your return type is declared as APIResponse<T>. However, you are returning APIResponse<T>.Result, which is most likely of type T.

It's not clear why you're using Task.Run instead of RestSharp's built-in async support.
C#
public async Task<APIResponse<T>> ExecuteAsync<T>()
{
    IRestResponse<T> response = client.ExecuteTaskAsync<T>(request);
    if (response.StatusCode == HttpStatusCode.OK)
    {
        return new APIResponse<T>
        {
            Success = true,
            Result = response.Data,
        };
    }
    
    LogError(new Uri(baseURL), request, response);
    return default; // Or return default(APIResponse<T>); if you want to be explicit
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: What's Wrong With This??? Pin
Kevin Marois9-Nov-20 7:42
professionalKevin Marois9-Nov-20 7:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.