我正在使用MVC,使用RSS从wired.com获取Feed。但我不需要所有的饲料,我只需要前五个饲料。我怎么能这样做?
with tf.device(tf.train.replica_device_setter(ps_tasks=2, ps_device="/job:ps",
worker_device="/job:worker")):
v1 = tf.Variable(1., name="v1") # pinned to /job:ps/task:0 (defaults to /cpu:0)
v2 = tf.Variable(2., name="v2") # pinned to /job:ps/task:1 (defaults to /cpu:0)
v3 = tf.Variable(3., name="v3") # pinned to /job:ps/task:0 (defaults to /cpu:0)
s = v1 + v2 # pinned to /job:worker (defaults to task:0/cpu:0)
with tf.device("/task:1"):
p1 = 2 * s # pinned to /job:worker/task:1 (defaults to /cpu:0)
with tf.device("/cpu:0"):
p2 = 3 * s # pinned to /job:worker/task:1/cpu:0
答案 0 :(得分:0)
您可以使用Enumerable.Take(int)。 返回指定数量的元素
IEnumerable<RSSFeed> RSSFeedData = (from x in xml.Descendants("item")
select new RSSFeed
{
Title = ((string)x.Element("title")),
Link = ((string)x.Element("link"))
}).Take(5);
这里的文档 https://msdn.microsoft.com/it-it/library/bb503062(v=vs.110).aspx