CommandLineBuilder.AppendFileNamesIfNotNull Method

Definition

Appends the command line with a list of file names, inserting quotation marks if necessary.

Overloads

AppendFileNamesIfNotNull(ITaskItem[], String)

Appends array of ITaskItem specs as file names, quoting them if necessary, delimited by a delimiter. This method appends a space to the command line (if it's not currently empty) before the file names.

AppendFileNamesIfNotNull(String[], String)

Appends array of file name strings, quoting them if necessary, delimited by a delimiter. This method appends a space to the command line (if it's not currently empty) before the file names.

AppendFileNamesIfNotNull(ITaskItem[], String)

Appends array of ITaskItem specs as file names, quoting them if necessary, delimited by a delimiter. This method appends a space to the command line (if it's not currently empty) before the file names.

public:
 void AppendFileNamesIfNotNull(cli::array <Microsoft::Build::Framework::ITaskItem ^> ^ fileItems, System::String ^ delimiter);
public void AppendFileNamesIfNotNull (Microsoft.Build.Framework.ITaskItem[] fileItems, string delimiter);
member this.AppendFileNamesIfNotNull : Microsoft.Build.Framework.ITaskItem[] * string -> unit
Public Sub AppendFileNamesIfNotNull (fileItems As ITaskItem(), delimiter As String)

Parameters

fileItems
ITaskItem[]

Task items to append, if null this method has no effect

delimiter
String

Delimiter to put between items in the command line

Examples

See example in AppendFileNamesIfNotNull.

See the string[] overload version

Remarks

This method appends the command line with file names, and surrounds the file names with quotation marks as necessary. The file names are separated by the specified delimiter.

If the command line is not empty, then this method also appends the command line with a space, before the file names.

Applies to

AppendFileNamesIfNotNull(String[], String)

Appends array of file name strings, quoting them if necessary, delimited by a delimiter. This method appends a space to the command line (if it's not currently empty) before the file names.

public:
 void AppendFileNamesIfNotNull(cli::array <System::String ^> ^ fileNames, System::String ^ delimiter);
public void AppendFileNamesIfNotNull (string[] fileNames, string delimiter);
member this.AppendFileNamesIfNotNull : string[] * string -> unit
Public Sub AppendFileNamesIfNotNull (fileNames As String(), delimiter As String)

Parameters

fileNames
String[]

File names to append, if it's null this method has no effect

delimiter
String

The delimiter between file names

Examples

AppendFileNamesIfNotNull(new string[] {"Alpha.cs", "Beta.cs"}, ",") yields Alpha.cs,Beta.cs.

AppendFileNamesIfNotNull(new string[] {"Alpha.cs", "Beta.cs"}, ",") => "Alpha.cs,Beta.cs"

Remarks

This method appends the command line with file names, and surrounds the file names with quotation marks as necessary. The file names are separated by the specified delimiter.

If the command line is not empty, then this method also appends the command line with a space, before the file names.

Applies to