I am trying to convert a DateTime and an int property into a string in a foreach loop. I need to put the information that is stored in the objects properties into the variables and then use that info to write to a text file using StreamWriter. I'm not quite sure what I am doing wrong. Parse is red underlined with this error message -
Error 2 'string' does not contain a definition for 'Parse'
Here is my code -
public bool Save()
{
string appointStart;
string appointLength;
string appointDescription;
foreach (Appointment appointment in appointments)
{
appointStart = string.Parse(appointment.Start);
appointLength = string.Parse(appointment.Length);
appointDescription = appointment.DisplayableDescription;
}
return true;
}
Thank you
ParseinStringclass. Can you please show an example input and outputs?