执行一个查询每次都能返回一个string[] 数组 但是数组的大小都不确定,有什么好的建议 目前先用object 顶一下
object value =(
from entry in nodes.Cast<HtmlNode>()
let Name = entry.Attributes["name"]
let Content = entry.Attributes["content"]
where Name != null && !string.IsNullOrEmpty(Name.Value) && Content != null && !string.IsNullOrEmpty(Content.Value)
select Name.Value + ": " + Content.Value).ToArray();
object value =(
from entry in nodes.Cast<HtmlNode>()
let Name = entry.Attributes["name"]
let Content = entry.Attributes["content"]
where Name != null && !string.IsNullOrEmpty(Name.Value) && Content != null && !string.IsNullOrEmpty(Content.Value)
select Name.Value + ": " + Content.Value).ToArray();
var value =(
from entry in nodes.Cast<HtmlNode>()
let Name = entry.Attributes["name"]
let Content = entry.Attributes["content"]
where Name != null && !string.IsNullOrEmpty(Name.Value) && Content != null && !string.IsNullOrEmpty(Content.Value)
select Name.Value + ": " + Content.Value).ToList();
class temp
{
public String Name{get;set;}
}
List<temp> value =(
from entry in nodes.Cast<HtmlNode>()
let Name = entry.Attributes["name"]
let Content = entry.Attributes["content"]
where Name != null && !string.IsNullOrEmpty(Name.Value) && Content != null && !string.IsNullOrEmpty(Content.Value)
select new temp{Name=Name.Value + ": " + Content.Value}).ToList();
string result=string.Join("$",(from entry in nodes.Cast<HtmlNode>()
let Name = entry.Attributes["name"]
let Content = entry.Attributes["content"]
where Name != null && !string.IsNullOrEmpty(Name.Value) && Content != null && !string.IsNullOrEmpty(Content.Value)
select Name.Value + ": " + Content.Value).ToArray());从库里取出再Split('$') 转成string[]