I am hoping that by asking this question I find a far more effiecient method of doing what it is that I am trying to do.
To start, I have a function whose parameters look as follows:
private void exampleVoid(string filePath, params string[] sourceFile) {
// Code ...
}
**Notice: I am passing the ‘sourceFile’ parameters into a CodeDom method. This method throws an error if any of the parameters are null.**
My call to exampleVoid looks as follows:
exampleVoid(@"C:\test.txt",
"Some Data",
"Some More Data",
"Even more data");
Under certain cercumstances, the second string in the array (labled “Some More Data”) may have to be removed and not passsed to the exampleVoid() method. So, is there some way of removing this string from the array alltogether? Keep in mind that nulling the string out will not work as an exception will be thrown.
Thank you for reading, as well as any further help.
Evan
You cannot remove the string from the array. Creating a new array that includes all other items except the one you want to include is your only option. The code is easy enough: