Skip to content

Add generic interfaces to PrinterSettings.StringCollection #10795

@JeremyKuhne

Description

@JeremyKuhne

Background and motivation

PrinterSettings.StringCollection implements ICollection, but not ICollection<string>. It really isn't meant to be mutated, but implementing IReadOnlyList<string> is trivial (it already has everything except for IEnumerable<string>GetEnumerator().

API Proposal

namespace System.Drawing.Printing;

-public class StringCollection : ICollection
+public class StringCollection : ICollection, IReadOnlyList<string>
{
+    IEnumerator<string> IEnumerable<string>.GetEnumerator();
}

API Usage

PrinterSettings.InstalledPrinters. // Any IEnumerable<string> extension

Metadata

Metadata

Assignees

No one assigned

    Labels

    🚧 work in progressWork that is current in progressapi-approved(4) API was approved in API review, it can be implemented

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions