Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# C HtmlNodeCollection-在元素中查找元素_C#_Html - Fatal编程技术网

C# C HtmlNodeCollection-在元素中查找元素

C# C HtmlNodeCollection-在元素中查找元素,c#,html,C#,Html,我有以下代码: <div class="field"> <label class="label">Email:</label> <div class="data"> <a href="mailto:1111@gmail.com">1111@gmail.com</a> </div> </div> <a href="mailto:2222@gmail.com"

我有以下代码:

<div class="field">
    <label class="label">Email:</label>
    <div class="data">
        <a href="mailto:1111@gmail.com">1111@gmail.com</a>
    </div>
</div>
<a href="mailto:2222@gmail.com">2222@gmail.com</a>
所以我在html页面中有两封电子邮件。 我只想得到1111@gmail.com,我不在乎2222@gmail.com. 我想找到特定的电子邮件,所以我想找到标签,在里面我会找到特定的标签。 提前感谢。

尝试使用和

应该行得通

    var webGet=new HtmlWeb(); 
    var docMain=webget.Load("yourUrl");
    var yourEmail=docMain.DocumentNode.SelectSingleNode("//div[@class=data]/a").Attributes["href"].Value