【发布时间】:2016-01-29 13:37:57
【问题描述】:
我知道这个问题是用 c# 回答的,但是当我尝试将它从 c# 在线转换为 vb.net 时,我遇到了运行错误。
免责声明这是不是我的代码
string personName = txtPersonName.Text;
int personAge = Convert.ToInt32(txtAge.Text);
var opportunites = from p in this.DataContext.Persons
select new
{
p.PersonID,
p.Name,
p.Age,
p.Gender
};
if (personsID != 0)
opportunites = opportunites.Where(p => p.PersonID == personID);
if (personName != string.Empty)
opportunites = opportunites.Where(p => p.Name.StartsWith(personName));
if (personAge != 0)
opportunites = opportunites.Where(p => p.Age == personAge);
有人可以帮我转换这段代码吗?我认为它是 c#,但我无法将它正确转换为 vb.net 我试过 telerik 但没有运气。
我无法在我的 if 语句中调用/使用 linq select new {} 中的“p”。
【问题讨论】: