Hi,
I am fairly new to c# .net language and have been using a set of code I was given to learn from. I have found a suitable part which I would like to change, I am however finding it a big hurdle to get going.
The trouble I have is that the timeFormApi.GetMeetingsOnDate call fills an array with more than 1 row of data. timeFormApi.GetRaceList uses two values from the GetMeetingsOnDate response getMeetingsOnDateResp to fulfill the timeFormApi.GetRaceList call.
My problem is that the [0] is hardcoded and returns a set of values, I'd like to cycle through a set of values in getMeetingsOnDateResp[?] and output the response to screen.
I currently use the following code to output to screen.....any comments on how to improve this would also be appreciated.
Thanks in advance
Matt
I am fairly new to c# .net language and have been using a set of code I was given to learn from. I have found a suitable part which I would like to change, I am however finding it a big hurdle to get going.
Console.WriteLine("GetMeetingsOnDate");
var getMeetingsOnDateResp = timeFormApi.GetMeetingsOnDate(DateTime.Now);
Console.WriteLine("GetRaceList");
var getRaceListresp = timeFormApi.GetRaceList
(
getMeetingsOnDateResp[0].race_date,
getMeetingsOnDateResp[0].course_number
);The trouble I have is that the timeFormApi.GetMeetingsOnDate call fills an array with more than 1 row of data. timeFormApi.GetRaceList uses two values from the GetMeetingsOnDate response getMeetingsOnDateResp to fulfill the timeFormApi.GetRaceList call.
My problem is that the [0] is hardcoded and returns a set of values, I'd like to cycle through a set of values in getMeetingsOnDateResp[?] and output the response to screen.
I currently use the following code to output to screen.....any comments on how to improve this would also be appreciated.
if (getMeetingsOnDateResp != null && getMeetingsOnDateResp.Count > 0)
{
foreach (var meetingsOnDateResp in getMeetingsOnDateResp)
{
var textToDisplay = string.Format
(
@"{0},{1},{2},{3},{4},{5}",
meetingsOnDateResp.race_day,
meetingsOnDateResp.course_number,
meetingsOnDateResp.race_surface,
meetingsOnDateResp.race_date,
meetingsOnDateResp.course_description,
meetingsOnDateResp.meeting_number
);
Console.WriteLine(textToDisplay);
}
}
else
{
Console.WriteLine("No data to display.");
};Thanks in advance
Matt