0

I am trying to pass a list of strings as a parameter to powershell script. That list may contain any number of argument varies every time. How do I pass this list as a one parameter to powershell script from C#?

1 Answer 1

1

PowerShell parameters are separated by commas. Just add the parameters comma separated behind the call.

Edit after comment:

Is it maybe possible to change the List<string> to a StringBuilder and after each add just add an additional ,?

If that is not possible try it like: List of strings to one string

StringBuilder builder = new StringBuilder();
los.ForEach(s => builder.Append(s+","));
Sign up to request clarification or add additional context in comments.

2 Comments

@sebinel i want to pass list ,that is dyanamic list (LIST<String>)...this list as one parameter
ah okay. didn't get that from your question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.