I have a string array like this.
string[] queries
with data more than one string.
I want to skip the last string from the element and take the r
Edited: You could effectively replace your array with the same array minus the last element with the following line or code:
queries = queries.Take(queries.Length - 1).ToArray();
If you would like to create a method that does this for you, then you could use the following:
public static string[] TrimLastElement(string[] arr) {
return arr.Take(arr.Length - 1).ToArray();
}
And implement it in your code like so:
queries = TrimLastElement(queries);