microsoft / WindowsCompositionSamples

The Windows Composition Samples have moved here: https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/SceneGraph
https://github.com/microsoft/WindowsAppSDK-Samples/tree/main/Samples/SceneGraph
MIT License
1.12k stars 287 forks source link

Magic property strings #57

Closed espenrl closed 8 years ago

espenrl commented 8 years ago

This is a suggestion for readability - use nameof operator to clarify where property names origins.

Instead of visual.StartAnimation("RotationAngle", ...)

use visual.StartAnimation(nameof(Visual.RotationAngle), ...)

Instead of implicitAnimationCollection["Offset"] = ...

use implicitAnimationCollection[nameof(Visual.Offset)] = ...

pgills commented 8 years ago

@espenrl Thanks for the suggestion. Mostly it comes down to style to sample authors.

Folks on the team are starting to leverage some of the new features in C# 6.0 like the nameof operator and string interpolation when using our Expressions, KeyframeAnimations, and ExpressionAnimations.

aL3891 commented 8 years ago

Fyi, my CompositionAnimationToolkit library now has support for using a lambda to start and stop animations

pgills commented 8 years ago

Thanks for the feedback. We will start to recommend folks using the nameof operator where appropriate in future samples to help will discoverability and readability of the samples. Closing and captured in Feedback milestone.