请将这个 LINQ C# 转换为 VB
你好 我在网上找到了这段代码,但无法将其转换为 vb。 如果有人帮我将此 LINQ C# 代码转换为 VB,我将非常感激。 这是代码:
/// <summary>
///
/// </summary>
/// <returns></returns>
[DataObjectMethod(DataObjectMethodType.Select)]
public IEnumerable<Customer> FindByID(string id)
{
// find the customer
return (from c in this.Customers where c.ID == id select c).ToList();
}
/// <summary>
///
/// </summary>
/// <param name="customer"></param>
public void Update(Customer newValues)
{
// simulate putting this record back into the database
Customer oldValues = this.Customers.Find(x => x.ID == newValues.ID);
oldValues.CompanyName = newValues.CompanyName;
oldValues.ContactName = newValues.ContactName;
oldValues.ContactTitle = newValues.ContactTitle;
oldValues.Address = newValues.Address;
oldValues.City = newValues.City;
oldValues.State = newValues.State;
oldValues.ZIPCode = newValues.ZIPCode;
oldValues.Phone = newValues.Phone;
}
}
非常感谢您为我做这件事。 马特
Hi
I found this code on line and cannot convert it over to vb.
I would really appreciate it if someone would convert this LINQ C# code to VB for me.
Here is the code:
/// <summary>
///
/// </summary>
/// <returns></returns>
[DataObjectMethod(DataObjectMethodType.Select)]
public IEnumerable<Customer> FindByID(string id)
{
// find the customer
return (from c in this.Customers where c.ID == id select c).ToList();
}
/// <summary>
///
/// </summary>
/// <param name="customer"></param>
public void Update(Customer newValues)
{
// simulate putting this record back into the database
Customer oldValues = this.Customers.Find(x => x.ID == newValues.ID);
oldValues.CompanyName = newValues.CompanyName;
oldValues.ContactName = newValues.ContactName;
oldValues.ContactTitle = newValues.ContactTitle;
oldValues.Address = newValues.Address;
oldValues.City = newValues.City;
oldValues.State = newValues.State;
oldValues.ZIPCode = newValues.ZIPCode;
oldValues.Phone = newValues.Phone;
}
}
Thank you soo much for doing this for me.
Matt
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该能够使用:
You should be able to use: