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 trial

C# C# Basics Strings Combining Strings

Concatenation

Everything I put in my methods body keeps returning an error.

Program.cs
using System;

class Program
{

    // YOUR CODE HERE: Define an Eat method!
    static string Eat(string firstString, string secondString)
    {

        return;
    }

    static void Main(string[] args)
    {
        string firstString = "I think";
        string secondString = "are tasty";

        Console.WriteLine(Eat($"{firstString} apples and blueberries {secondString}"));
        Console.WriteLine(Eat($"{firstString} carrots and daikon {secondString}"));
    }

}

1 Answer

Steven Parker
Steven Parker
231,268 Points

Part of the issue is that you should put your code only in your method. Don't make any changes to the "Main" method!

Then, be sure to return the string you build in the method using the arguments that are passed in.

Thank you!

Sebastian Manczak
Sebastian Manczak
3,551 Points

Any chance you could please post the final correct answer to the task?

Steven Parker
Steven Parker
231,268 Points

Treehouse discourages posting of explicit answers, but that would generally not be the best thing to help you learn anyway.

If you're having trouble, start a new question where you can post your code and get some hints to help you solve it yourself.