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 Encapsulation with Properties Properties

Pretty sure im correct and getting compiler error about curly braces below get and set

I'm receiving compiler errors on lines 10 and 14 complaining about the braces but get and set do have their own braces. I don't know if its a bug in the challenge or I am mistaken in my code.

Any help is appreciated.

Frog.cs
namespace Treehouse.CodeChallenges
{
    public class Frog
    {
        private int _numFliesEaten;

        public int NumFliesEaten()
        {
            get
            {
                return _munFliesEaten;
            }
            set
            {
                _numFliesEaten = value;
            }
        }

    }
}

Apologies I have seen my issue. I had () above the get. Answered myself - oh dear.

Heath Hodgert
Heath Hodgert
Treehouse Guest Teacher

remove the parentheses after the NumFliesEaten. Unlike a method when defining a property it does not have parentheses. Think about when you use a property it doesn't need parentheses.