-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Net.Httphelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
Background and motivation
Methods and extension methods that don't modify a dictionary often expect a parameter of IReadOnlyDictionary
instead of IDictionary
.
API Proposal
namespace System.Net.Http
{
public class HttpRequestOptions : IReadOnlyDictionary<string,object>, // NEW
IDictionary<string, object> // EXISTING
{
[...]
}
}
API Usage
var dic = (IReadOnlyDictionary<string,object>)request.Options;
Alternative Designs
No response
Risks
In rare circumstances, a method will have an overload for IDictionary and another overload for IReadOnlyDictionary. This would be ambiguous for HttpRequestOptions, as it is for other dictionaries.
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Net.Httphelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors