-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API proposal]: add ProcessStartInfo constructor that accepts IEnumerable<string> arguments. #66450
Comments
Tagging subscribers to this area: @dotnet/area-system-diagnostics-process Issue Details ProcessStartInfo(string fileName, IEnumerable<string> arguments) was proposed in #371 (comment). But the API was omitted after review: #371 (comment). In the API review it is assumed, you can do ProcessStartInfo psi = new();
psi.ArgumentList.AddRange(args); However For consistency with Using cc @adamsitnik
|
@tmds I am supportive of this idea. Could you please fill the official template? |
I've applied the template. |
@adamsitnik is this good for |
@tmds it's is, I've applied the label. Thanks! |
Looks good as proposed. namespace System.Diagnostics
{
public partial class ProcessStartInfo
{
public ProcessStartInfo(string fileName, IEnumerable<string> arguments);
}
} |
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 anIEnumerable
.If you need to use
ProcessStartInfo
to make additional configuration, like redirecting the streams, there is no way to pass in theIEnumerable<string>
.Process.ArgumentList
is aCollection<string>
. Because it doesn't have anAddRange
, the user needs to add a loop to add the arguments one-by-one.API Proposal
A constructor can be added to
ProcessStartInfo
.This is consistent with rest of the API of
Process
whereIEnumerable<string>
overloads were added to existing APIs that acceptedstring arguments
.API Usage
Alternative designs
Risks
The text was updated successfully, but these errors were encountered: