-
-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve variable initialization #2223
Conversation
private readonly ConcurrentDictionary<string, string> _parentIds = new(); | ||
private readonly ConcurrentDictionary<string, List<string>> _childIds = new(); | ||
private readonly ConcurrentDictionary<string, List<TaskCompletionSource<Frame>>> _waitRequests = new(); | ||
private readonly AsyncDictionaryHelper<string, Frame> _asyncFrames; | ||
|
||
public FrameTree() | ||
{ | ||
_frames = new(); | ||
_asyncFrames = new AsyncDictionaryHelper<string, Frame>(_frames, "Frame {0} not found"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love C# to allow us to move this as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you!
Let me know if you want to implement that nitpick
All actionable comments should be resolved now. |
This PR has three parts each in separate commits:
1: combine initialization of fields with their declaration, this helps avoiding using a field before it has been initialized
2: Some small optimizations on dictionaries.
3: using target-typed new constructors some more places