dansiegel / dansiegel/CodeGenHelpers
Example from readme doesn't work
- Dominant language
- C#
- Stars
- 107
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
I've just found this project and decided to try it out by copying the example provided in the readme. On doing so I found some issues, although since I'm not familiar with the project it may be my fault.
- The `ClassBuilder.AddConstructor` method returns a `ConstructorBuilder` which doesn't contain an `AddProperty` method. \
This requires using the `Class` property to go back to the `ClassBuilder`. \
Alternatively, maybe `ConstructorBuilder` could add the `AddProperty` method so the example just works. It seems other builders follow this pattern (e.g.: `ClassBuilder.AddNamespaceImport`).
- The `ClassConstructor.AddProperty` method doesn't have an overload that takes the type of the property. \
This requires using the `PropertyBuilder.SetType` method.
However, specifying the type of the property is required so I feel like it would be better to add a parameter[^1] to the `AddProperty` method which would make the example work.
- The generated output doesn't include the accessibility modifiers since they weren't specified. \
I suggest adding the accessibility modifiers to the example or modifying the output in the readme to match the generated output.
- The generated output always adds the namespace in the `SomeOtherType` parameter and property, but the output in the readme doesn't include it. \
If this is intentional, I think the output in the readme should be modified to match the generated output.
- The generated output declares the properties in reverse order, unlike what's being shown in the readme. \
Should the property order be respected or is this intentional?
I'm willing to make a PR with the changes needed to fix this issue, let me know what would be the preferred way to resolve it.
[^1]: It can be a new overload to preserve binary compatibility, not sure how important that is for this project.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.