Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialDavid Fuchssteiner
13,236 PointsC# Streams and Data Processing - Working with DateTime Challenge
Hey guys!
I got a Problem with one of the C# Streams and Data Processing Challenges! Maybe someone can help me out!
here is my code:
using System; using System.IO;
namespace Treehouse.CodeChallenges { public class Program { public static void Main(string[] arg) { }
public static string ParseWeahterForecast(string[] values)
{
var weatherForecast = new WeatherForecast();
weatherForecast.WeatherStationId = values[0];
return weatherForecast;
}
}
}
i always get the same error:
Program.cs(17,20): error CS0029: Cannot implicitly convert type Treehouse.CodeChallenges.WeatherForecast' to
string'
Compilation failed: 1 error(s), 0 warnings
i think i have to explicitly convert the type `Treehouse.CodeChallenges.WeatherForecast' to 'string', but i don't know how to do that! I already looked up the C# documentation, but couldn't figure it out!
Mabye someone can help me!
2 Answers
Steven Parker
231,236 PointsYou forgot to include a link to the challenge itself, but I'll take a guess based on your code.
You may have declared your function as the wrong type.
Your return doesn't match your declaration, so I'll guess the declaration should be this:
public static WeatherForecast ParseWeatherForecast(string[] values)
Also, check the spelling of the function name.
David Fuchssteiner
13,236 PointsAha! thank you!!! i totally overlooked that!