【发布时间】:2023-03-15 14:35:02
【问题描述】:
有人可以帮我把这个使用新 C# 6 语法的简单 sn-p 翻译成 Vb.Net 吗?
在某些在线服务(例如来自 Telerik 的服务中进行翻译时,生成的 LINQ 查询不完整(语法错误)。
/// <summary>
/// An XElement extension method that removes all namespaces described by @this.
/// </summary>
/// <param name="this">The @this to act on.</param>
/// <returns>An XElement.</returns>
public static XElement RemoveAllNamespaces(this XElement @this)
{
return new XElement(@this.Name.LocalName,
(from n in @this.Nodes()
select ((n is XElement) ? RemoveAllNamespaces(n as XElement) : n)),
(@this.HasAttributes) ? (from a in @this.Attributes() select a) : null);
}
【问题讨论】:
-
Reflector v9 在将其反编译为 VB 方面做得非常好。只需获取您自己的副本即可。
-
这可能有效。 Convert Code 或让您非常接近。
标签: c# .net vb.net syntax code-translation