I am looking at better way of writing following code using linq/lambda expression..
I am trying to form a string from list. I have function that convert t to string. So what i want is have a string from list.
Here is pseudo code:
string strTemp;
foreach (SearchTerm s in terms)
{
strTemp += string.Format(" and {0} ", s.CreateToString());
}
where terms is list<searchTerms>.
Like this:
If you’re not using .Net 4.0, you’ll need to add
.ToArray().If you’re calling the
ToStringmethod on eachterm(as opposed to a different method) and you are using .Net 4.0, you can simply write