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 trialPeter Furler
31,647 PointsWhat is the reasoning behind making the MorseCodeTranslator a static class?
Am I correct in presuming it is because the string values of TKey and TValue will never change?
2 Answers
Mark VonGyer
21,239 PointsThe class is static because the fields and functions are static, so allowing the class to be instantiated is pointless. The functions and fields are static because we expect the operation to remain the same in all situations.
K Cleveland
21,839 PointsIn a way, yes. You're not going to be changing anything with that class, inheriting it, or instantiating it. You're basically just going to access the members in the class and let them do whatever it is you'd like, as demonstrated by this line from the video:
string output = MorseCodeTranslator.ToMorse(input);
Good catch!