Need an immediate help regarding Linq [Resolved]

Posted by balajirnaukri-12656 under ASP.NET on 4/20/2012 | Points: 10 | Views : 760 | Status : [Member] | Replies : 4
I am using the stringBuilder

stringBuilder sb= new StringBuilder();

im having the listbox named listbox1

for (int i = 0; i < listbox1.items.count;i++)
{

sb.Append(listbox1.items[i].value.Tostring() + ",");

}

I want this code to be changed into Linq can anyone help me

Thanks and Regards
Balaji.R
ASP.NET Devloper
Solve-IT corp



Responses

Posted by: Savariya on: 4/20/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
var items = from item in listView1.Items.OfType<ListViewItem>()
select item.Text;

string s = string.Join(",", items.ToArray());


Mark this as answer if its help you.........
Thanks

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: balajirnaukri-12656 on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
thanks savariya

Thanks and Regards
Balaji.R
ASP.NET Devloper
Solve-IT corp

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Savariya on: 4/20/2012 [Member] Starter | Points: 25

Up
0
Down
Your Welcome

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/21/2012 [Member] Silver | Points: 25

Up
0
Down
@savariya

thank u

Regards,
Singaravel M

balajirnaukri-12656, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response