Ad
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 ?
Ad
Answer
the signature of GenerateRequestUriData
has four parameters
GenerateRequestUriData(string endpoint, string dateQuery, string num, int statNum)
you are only passing ONE
GenerateRequestUriData(Constants.EndPoint)
you either need to pass all the required parameters, or set default values for them
Ad
source: stackoverflow.com
Related Questions
- → How to Fire Resize event after all images resize
- → JavaScript in MVC 5 not being read?
- → URL routing requires /Home/Page?page=1 instead of /Home/Page/1
- → Getting right encoding from HTTPContext
- → How to create a site map using DNN and C#
- → I want integrate shopify into my mvc 4 c# application
- → Bootstrap Nav Collapse via Data Attributes Not Working
- → Shopify api updating variants returned error
- → Get last n quarters in JavaScript
- → ASP.NET C# SEO for each product on detail page on my ECOMMERCE site
- → SEO Meta Tags From Behind Code - C#
- → onchange display GridView record if exist from database using Javascript
- → How to implement search with two terms for a collection?
Ad