-
Notifications
You must be signed in to change notification settings - Fork 78
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
Simplify the reading of DictionaryProperty #216
Conversation
@@ -2,7 +2,7 @@ | |||
|
|||
namespace OpenMcdf.Ole; | |||
|
|||
public class DictionaryProperty : IProperty | |||
public sealed class DictionaryProperty : IProperty |
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.
TBD: I'm not sure if this needs to be public at all
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.
OLE isn't really my thing, so I have no idea how this intended to be used. I'm generally in favour of sealing unless there's a reason not to and the class is designed to be extended though. I'm happy to defer to your judgement. The rest all LGTM.
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.
Basically I'm not clear why DictionaryProperty would be public when all the other implementations of IProperty (i.e the TypedPropertyValue classes) appear to be internal.
Usage of those classes is generally part of PropertyFactory and/or PropertySetStream, and both of those are internal
Has a trivial reduction in allocations as a side effect
to
(that will vary depending on how many properties there are) |
A thought whilst we're open for API changes:
As it stands, for each entry in the property name dictionary, DictionaryProperty
This seems a bit round about to me for what it's doing, so I propose just doing a simple inline read and not having an instanced DictionaryEntry class.
This also makes it easier to see if the ReadBytes calls could be changed to Read or merged together and and then sliced with spans later.