I want to extract come text between two tags. The \"txtReadfile\" contains many tags. I want to extract all the text in each occurrence of the tag.
I used the following
Try with:
string output = string.Join(" ", destList.ToArray());
you have to convert it to ToArray()
string.join(" ",destList.ToArray());
Before .NET 4, the String.Join
method only had overloads that took arrays as their second parameter. Support for IEnumerable<string>
was only introduced in .NET 4.0.
// From .NET 2.0:
Join(String, String[])
Join(String, String[], Int32, Int32)
Join(String, Object[])
// From .NET 4.0:
Join(String, IEnumerable<String>)
Join<T>(String, IEnumerable<T>)
Thus, if you're targeting an earlier framework, you need to call ToArray
on your list to convert it into string[]
:
string output= string.Join(" ", destList.ToArray());
Most likely, you are using .NET 3.5 or below. In this version string.Join
only had two overloads.
You need to convert your list to an array to be able to pass it in this version.
Simply use the ToArray method of List<T>
:
string.Join(" ", destList.ToArray());