Kotlin Discussions
C# style object initialiser
yole
July 10, 2017, 9:30am
2
There’s the
apply
method:
val emp_001 = Employee().apply { age = 25 name = "Javed Khan" }
1 Like
show post in topic
Related topics
Topic
Replies
Views
Activity
How about a "with" extension method to be like C# object initializer?
2
2564
July 20, 2015
Constuctors in Kotlin
6
1158
June 7, 2012
Kotlin - mutate class properties during class object initialization
Support
1
495
October 16, 2022
Constructors in Kotlin
6
3292
March 12, 2015
Proposal: syntax to condense class initialization via DSLs
Language Design
12
1611
April 3, 2022