How to covert IpAddress items to string c#

I have a ListBox that contains a System.net.IPAddress and string items. I want to convert them all to strings. I have tried this as shown below but it says it can not cast from IPAddress to string.

var List4 = f.listBox4.Items.Cast<String>().ToList();
foreach (string i in List4)
{
    cursheet.get_Range(colname + x).Value = i;
    x++;
}

Answers


How about this? No need for linq, casting, etc..

foreach (var item in f.listBox4.Items) 
{ 
    cursheet.get_Range(colname + x).Value = item.Text; 
    x++; 
} 

Or, if you want the value:

foreach (var item in f.listBox4.Items) 
{   
    cursheet.get_Range(colname + x).Value = item.Value; 
    x++; 
} 

var List4 = f.listBox4.Items.Cast<object>().Select(x => x.ToString())

Need Your Help

accessing xaml control from mainviewmodel

c# xaml windows-phone-8

I have maps control in my xaml windows phone apps and I want to access my map from my mainviewmodel since there is where I put all my logic code in there, is there anyway to add it?

How do I populate multiple textboxes based on a dropdown list selection?

c# asp.net

I have a form with a dropdown list and 3 textbox fields. The dropdown list is supposed to populate the 3 textboxes. So far I got it to populate 2 textboxes but I don't know how I can populate the 3...