Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Figure out how to make immutable header value objects #177

Closed
@Tratcher

Description

@Tratcher

Related: #176

Scenario:
MVC uses some lists of MediaTypeHeaderValues to determine what formats are supported. They select one from the list and use it to configure the response. Sometimes this involves modifying the value (e.g. adding charset), however this affects the value in the list and may impact matching and output for subsequent requests. The correct code would make a copy of the header value first.

Figure out how to make immutable header value object to prevent erroneous modifications.

Some ideas:

  • Add a method (MakeReadOnly()) or property (IsReadOnly) to lock a header value object into read-only mode so it throws if anyone tries to make inappropriate modifications.
  • Have an abstract base class with mutable and immutable implementations.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions