Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Transform:
- class C
- {
- public lazy string SomeProperty
- {
- get
- {
- return SomeLengthyCalculation();
- }
- }
- public C()
- {
- ...
- }
- }
- //To:
- class C
- {
- public string SomeProperty
- {
- get
- {
- return SomePropertyBackingField.Value
- }
- }
- public C()
- {
- ...
- SomePropertyBackingField = new Lazy<string>(SomeLengthyCalculation);
- }
- private readonly Lazy<string> SomePropertyBackingField;
- }
Add Comment
Please, Sign In to add comment