-
-
Save jwalgemoed/74b0d3ff606643cea3c9d3d4b18001ca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val fileContents by FileLoaderDelegate("someFile.txt") | |
class FileLoaderDelegate(private val filename: String) { | |
operator fun getValue(thisRef: Any?, property: KProperty<*>): Any { | |
return readFile(filename) | |
} | |
} | |
fun main(args: Array<String>) { | |
println(fileContents) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment