fun ContentType.withCharset(charset: Charset) = withParameter("charset", charset.name())
Why isn't it placed inside the class?
d
diesieben07
07/03/2017, 6:51 PM
thisen: In this case it looks like utility methods that are just simple helpers for other methods in the class are implemented as extension functions, which is the approach I would take, too. Then you don't have to clutter your class with those helper methods.
t
thisen
07/03/2017, 6:52 PM
But the extension can be used "outside" this .kt file, right?
d
diesieben07
07/03/2017, 6:53 PM
Yes, you just need to import it like a class.
t
thisen
07/03/2017, 6:53 PM
Great. I get the idea. Thank you for the quick reply. 🙂