Skip to content

Example from readme doesn't work #57

Open
@raulsntos

Description

@raulsntos

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 parameter1 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.

Footnotes

  1. It can be a new overload to preserve binary compatibility, not sure how important that is for this project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions