'There is no argument given that corresponds to the required formal parameter - c#
I want to get datetime.now and pass like a parameter for api point from this method:
string GenerateRequestUriData(string endpoint, string dateQuery, string num, int statNum)
{
DateTime dateNow = DateTime.Now;
dateQuery = dateNow.ToString("yyyy-MM-dd");
num = daysBeforeData;
statNum = getStationNumber;
string requestUri = endpoint;
requestUri += "/hqdataahs/GetData?";
requestUri += $"date={dateQuery}&";
requestUri += $"num={num}&";
requestUri += $"statNum={statNum}&";
return requestUri;
}
In other method I try to receive data from API like this:
async void OnButtonClicked(System.Object sender, System.EventArgs e)
{
var result = await _restServiceStations.Get_HQ_AHS(GenerateRequestUriData(Constants.EndPoint));
}
But I receive error:
There is no argument given that corresponds to the required formal parameter 'dateQuery' of 'HQ_AHS.GenerateRequestUriData(string, string, string, int)'
Is there a way to fix this error ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
