Reputation: 727
I want to combine this two string values I have this LINQ code but I can't figure out how merge them I can only get the list by Object
List<string> All = new List<string>();
var _synopsis = ((IEnumerable<dynamic>)json.data.series.product
.Where(x => x.synopsis !=null)
.Select(x => x.synopsis).ToList());
var _number = ((IEnumerable<dynamic>)json.data.series.product
.Where(x => x.number != null)
.Select(x => x.number).ToList());
foreach (var a in _synopsis)
{
All.Add(a);
}
foreach (var x in _number)
{
All.Add(x);
}
I want the result become like this:
for example:
_synopsis(TITLE) + _number(EPISODE)
result: TITLE + EPISODE
Upvotes: 0
Views: 83
Reputation: 141845
I'm assuming you are looking for something like this:
List<string> All = ((IEnumerable<dynamic>)json.data.series.product
.Where(x => x.synopsis != null && x.number != null)
.Select(x => x.synopsis + " + " + x.number)
.ToList());
Upvotes: 1