Customization
I have three lists.
List<List<string>> tokens = new List<string>();
List<string> token = new List<string>();
List<string> sets = new List<string();
One complete list tokento be on the list tokens.
{"<card>"",
" <name>Domri Emblem</name>",
" <set picURL="http://magiccards.info/extras/token/Gatecrash/Domri-Rade-Emblem.jpg" picURLHq="" picURLSt="">GTC</set>",
" <color></color>",
" <manacost></manacost>",
" <type>Emblem</type>",
" <pt></pt>",
" <tablerow>0</tablerow>",
" <text></text>",
" <token>1</token>",
"</card>"}
The list setswill look as follows.
{"ARB", ..., "AVR", ..., "GTC", ..., "ZEN"}
I want to go through tokenin tokensand delete every line in tokenthat contains any of the elements in set.
Example
There tokensare several items in the list token. One token(say token1) has such an element.
{..., " <set picURL="http://magiccards.info/extras/token/Gatecrash/Domri-Rade-Emblem.jpg" picURLHq="" picURLSt="">GTC</set>", ...}
The other token(say token2) has these two elements.
{..., " <set picURL="http://magiccards.info/extras/token/magic-2012/pentavite.jpg" picURLHq="" picURLSt="">M12</set>",
" <set picURL="http://magiccards.info/extras/token/player-rewards-2004/pentavite.jpg" picURLHq="" picURLSt="">MI</set>", ...}
Say the list has setsbeen modified to contain only {"ARB", "GTC", "M12"}.
token tokens , sets? , token1 , 2 ?
token tokens token, "GTC".
foreach (var token in tokens)
{
token.RemoveAll(str => str.Contains("GTC"));
}
, .
foreach (var token in tokens)
{
token.RemoveAll(sets.Contains);
}
.