-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
C# has some nice syntax that allows you to avoid explicitly creating an extra, underlying instance variable to store the value when your variable doesn't have any extra processing:
public String MyString { get; set; }
I believe it would be possible to provide an out of the box implementation of this by extending your Property class. I imagine it would look something like this:
public class AutoProperty<T> extends Property<T> {
private T value;
public AutoProperty() {
super(() -> this.value, newValue -> this.value = newValue);
}
}
Then it would be used like this:
public class MyClass {
public Property<String> myString = AutoProperty<String>();
}
(I haven't fully flushed out the implications of this code. It's just an example implementation to start off with.)
Metadata
Metadata
Assignees
Labels
No labels