c#XML操作VB代码转换查询......等等!

时间:2021-09-20 03:14:26

I am following a VB tutorial to do some HTML manipulation using LINQ

我正在按照VB教程使用LINQ进行一些HTML操作

It has the following construct

它具有以下结构

Imports <xmlns="http://www.w3.org/1999/xhtml">

How do I do the same in C#?

我如何在C#中做同样的事情?

There appears to be something called an XMLNamespaceManager that may hold the solution, but I am too foolish to understand how to work it, and I am not sure it is the correct tree to bark up.

看起来有一些叫做XMLNamespaceManager的东西可以解决这个问题,但是我太愚蠢了解如何使用它,而且我不确定它是不是正确的树。

Got any advice?

有什么建议吗?

2 个解决方案

#1


2  

VB.Net has a feature called XML Literals that is not present in C#. This import statement adds a namespace for use with those literals.

VB.Net有一个名为XML Literals的功能,它不存在于C#中。此import语句添加了一个名称空间以供这些文字使用。

In researching this information, I found this link helpful:
http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx
It's also very informative for working with Excel xml docs, but that's a side issue ;)

在研究这些信息时,我发现此链接很有帮助:http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml .aspx它对于使用Excel xml文档也非常有用,但这是一个副作用;)

#2


1  

I think the example you're looking at may be using XML literals, which are not supported in C#.

我认为您正在查看的示例可能是使用XML文字,而C#不支持这些文字。

#1


2  

VB.Net has a feature called XML Literals that is not present in C#. This import statement adds a namespace for use with those literals.

VB.Net有一个名为XML Literals的功能,它不存在于C#中。此import语句添加了一个名称空间以供这些文字使用。

In researching this information, I found this link helpful:
http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml.aspx
It's also very informative for working with Excel xml docs, but that's a side issue ;)

在研究这些信息时,我发现此链接很有帮助:http://blogs.msdn.com/bethmassi/archive/2007/10/30/quickly-import-and-export-excel-data-with-linq-to-xml .aspx它对于使用Excel xml文档也非常有用,但这是一个副作用;)

#2


1  

I think the example you're looking at may be using XML literals, which are not supported in C#.

我认为您正在查看的示例可能是使用XML文字,而C#不支持这些文字。