-
Notifications
You must be signed in to change notification settings - Fork 238
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
Use a fixed list of operations in ReflectionGraphicsStateOperationFac… #832
Conversation
var result = new Dictionary<string, Type>(); | ||
|
||
foreach (var assemblyType in assemblyTypes) | ||
private static readonly IReadOnlyDictionary<string, Type> operations = |
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.
As it stands, operations
is instanced to the class, but as the contents is constant, is it ok for it be static instead?
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.
Now that there is a .NET 8 build, it may or may not be useful to see if using a FrozenDictionary would have any benefits here? (just a thought, i don't have any real experience with using those yet)
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 think that'd be definitely a great use of frozen dictionary here indeed!
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.
Updated to use FrozenDictionary in the .NET 8.0 build
…tory rather than searching via reflection.
….operations contains all supported graphics operations
Updated with an attempt at a unit test for checking that the operations dictionary contains all the operations |
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.
Thanks a lot for that @Numpsy, looks good to me with the tests!
…tory rather than searching via reflection.
The simple approach discussed in #790 , to just use a fix list of operations rather than doing anything clever.
It's a draft for comments, and because we might be able to add tests to
GraphicsStateOperationTests
to compare the fixed list with all the types it finds viaGetOperationTypes()