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

Sebastian Manczak
Sebastian Manczak
3,551 Points

Basic concatenation

I can't move forward. Could I please get more hints? This is what I have come up with so far:

Program.cs
using System;

class Program
{

    // YOUR CODE HERE: Define an Eat method!
    static string Eat(string s1 foodOne, string s2 foodTwo)
    {
      string s1 = "I think";
      string s2 = "are tasty";
      return;

    static void Main(string[] args)
    {
        Console.WriteLine(Eat("apples", "blueberries"));
        Console.WriteLine(Eat("carrots", "daikon"));
    }

}

2 Answers

Some hints:

  • For your parameters use s1 or foodOne but not both
  • You can complete the task with just a return statement
  • You concatenate with the + operator
  • A concatenated string with parameter s1 looks like this: "I think " + s1 + " can do this!"
  • You are missing a closing bracket on your Eat method
Sebastian Manczak
Sebastian Manczak
3,551 Points

Thank you. I think I am getting closer however I am missing something..

Eric M
Eric M
11,546 Points

What does your code look like now Sebastian?

Edit: Ah, I see you have posted again here.