@foreach (var item in User)
string title = item.FirstName;
string lat = item.Lat.Split('/').ToString();
string lng = lat;
string description = item.description;
但它显示的错误类似于System.ToString()
答案 0 :(得分:0)
@foreach (var item in User)
{
string title = item.FirstName;
string lat = item.Lat.Split('/').ToString();
string lng = lat;
string description = item.description;
}
为什么你需要这个.ToString();
如果此工作正常string title = item.FirstName;
可能是它已经到来的字符串.. 将代码放入try catch {}并调试并查看确切的错误
答案 1 :(得分:0)
@foreach (var item in User)
{
string title = item.FirstName;
string lat = item.Lat;
string latt=lat.Split('/');//text is hey/hi
string latte = latt[0];// if u want the 1st part like "hey"/hi this will give hey
string latti = latt[1];// if u want the 2nd part like hey/"hi" this will give hi
string lng = lat;
string description = item.description;
}