Skip to content

[API proposal]: add ProcessStartInfo constructor that accepts IEnumerable<string> arguments. #66450

@tmds

Description

@tmds

Background and motivation

Starting a process should be easy when you have an IEnumerable<string> with arguments.

This is true if you can use the static Process.Start overload that accepts an IEnumerable.

If you need to use ProcessStartInfo to make additional configuration, like redirecting the streams, there is no way to pass in the IEnumerable<string>.

Process.ArgumentList is a Collection<string>. Because it doesn't have an AddRange, the user needs to add a loop to add the arguments one-by-one.

API Proposal

A constructor can be added to ProcessStartInfo.

 ProcessStartInfo(string fileName, IEnumerable<string> arguments)

This is consistent with rest of the API of Process where IEnumerable<string> overloads were added to existing APIs that accepted string arguments.

API Usage

ProcessStartInfo psi = new("filename", GetArguments());

Alternative designs

Risks

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-approvedAPI was approved in API review, it can be implementedarea-System.Diagnostics.Processgood first issueIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributors

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions