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# Objects Methods Methods

Ryan Wood
Ryan Wood
888 Points

I am creating a parameter in my method but it is not being recognized and i'm not sure why.

I am supposed to create a method that takes in one parameter, distanceToFly, and see verify that the tongue can reach it. I feel like I am setting my parameters correctly but not sure how to correct it.

Frog.cs
namespace Treehouse.CodeChallenges
{
    class Frog
    {
        public readonly int TongueLength;

        public Frog(int tongueLength)
        {
            TongueLength = tongueLength;
        }

        public bool EatFly(DistanceToFly distanceToFly)
        {
            bool eatable = distanceToFly.X > 0 && distancToFly.X < TongueLength.length; 

            return eatable;
        }
    }
}

1 Answer

Ryan Wood
Ryan Wood
888 Points

I appreciate the help. I feel silly now but I was able to get it to compile and run after that an another small change. Thanks!