官术网_书友最值得收藏!

Getting ready

We can declare extension functions and extension properties inside any file in the project. However, to keep them well organized, it's better to put them in dedicated files.

The syntax for extension functions is very similar to the one of the standard function. We just need to add information about the type that is being extended with the new function, as follows:

fun SomeClass.newFunctionName(args): ReturnType {
// body
}
主站蜘蛛池模板: 于田县| 尼木县| 建瓯市| 雷州市| 安康市| 浏阳市| 敦化市| 新邵县| 怀安县| 秦皇岛市| 辽宁省| 江都市| 霍林郭勒市| 荆门市| 炉霍县| 托克逊县| 宜州市| 衡阳市| 湟源县| 黔西| 永仁县| 乐清市| 馆陶县| 金溪县| 罗田县| 东莞市| 桦川县| 桦南县| 信丰县| 邢台县| 察雅县| 庐江县| 金塔县| 微博| 高安市| 双桥区| 长葛市| 彭州市| 依兰县| 库尔勒市| 托克托县|