0

I have collection which has a list of CardnumberList. In this list how do I find if [I am inside foreach loop ] my Cardnumber exists or not. If it exists then I need to return TRUE or else FALSE.

For example :- CardnumberList = {10,20,30,40,50,60,70,80,90,100 }

Here – record is XML data : for example –

<Informations >
 <info>
                <CardHolderName>Test1</CardHolderName>
                <CardNumber>534234HHHHH0006</CardNumber>
                <CardType>KH</CardType>
</info>
<info>
                <CardHolderName>Test2</CardHolderName>
                <CardNumber>123456HHHHH0006</CardNumber>
                <CardType>KN</CardType>
</info>

</Informations >

var records = xmlFile.Elements("Informations").ToList();

  foreach (var row in records)
     {  
         var tranmissionRecords = row.Elements("info").ToList();
            foreach (var rec in tranmissionRecords)
               {
                 var CardNumber = rec.Element("CardNumber");
        // Here I need find whether above cardnumber present in my CardnumberList or not using LINQ , please help me 
                             }
    }

Reproduce steps :-

 List<string> CardnumberList = new List< string >();  
        lst.Add(10);  
        lst.Add(20);  
        lst.Add(30);  
        lst.Add(40);  
        lst.Add(50);  
        lst.Add(60);  
Kumas
  • 3
  • 6
  • 1
    This ***is*** a duplicate of about 100 or more questions, the only difference is likely the type (or not) – TheGeneral Nov 15 '21 at 22:34

0 Answers0