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 Inheritance Custom Exceptions

Can't figure out what I'm doing wrong when creating exception...

I think I'm doing something wrong when creating the constructor for the TooBigException class.

It keeps telling me this message: "Did you create a constructor for TooBigException that takes a string parameter?"

TooBigException.cs
namespace Treehouse.CodeChallenges
{
    class TooBigException : System.Exception
    {
        public TooBigException(String message) : base(message)
        {

        }
    }
}

1 Answer

Steven Parker
Steven Parker
231,236 Points

:point_right: You want to take a string (lowercase) parameter, not a String (uppercase S).

They are both valid types, but they are not the same thing.

Wow! Thank you very much! Now I'll be aware of it.

Aaahh the little details! It's awesome!

I have investigated a little bit and found that string is an alias in C# for System.String presuming that they are the same type.

Do you know where it is recommended to use each one? Is it better to use a particular one for consistency with your code?