Skip to content

Include section on how to create transient objects #5

@mvonballmo

Description

@mvonballmo

C# offers support for object-initialization, including init and required properties that allow a user to create immutable objects with a very convenient syntax.

Avoid using factories to create objects that are better created with new().

Drawbacks:

  • You can't use object-initialization syntax
  • It's difficult to find references to where these objects are created

For example, if you have a database layer that lets you create and save objects, an API that returns a new object is not ideal.

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