I have a c# code in which
I'm having a csv file containing customer data as follows:
ClientNumber1,Name1, BenefitCode1, EffectiveDt1
ClientNumber1,Name1, BenefitCode2, EffectiveDt2
ClientNumber2,Name2, BenefitCode3, EffectiveDt3
Now in this case I want the output XML to have mutliple tags for Benefit within same customer (eg, the first two rows in my csv have same customer but two different benefits)
My output xml should be like
<Member>
<Num>ClientNumber1<Num>
<Nm>Name1</Nm>
<Benefit>
<Bc>BenefitCode1</Bc>
<Dt>EffectiveDt1</Dt>
</Benefit>
<Benefit>
<Bc>BenefitCode2</Bc>
<Dt>EffectiveDt2</Dt>
</Benefit>
</Member>
<Member>
<Num>ClientNumber1<Num>
<Nm>Name2</Nm>
<Benefit>
<Bc>BenefitCode3</Bc>
<Dt>EffectiveDt3</Dt>
</Benefit>
</Member>
So basically, while I performing the LINQ I should also be able to check it with previous ClientNum and in case I have the same num, the benefit data should be added within the same Member tag.
Thanks.