由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - How to compare data in an Array and in Xml (转载)
相关主题
how to assign new value to loop variables?how to use array to simulate multi loops
Perl 6 改动很大很恶心怎么判断int a[]的array的实际长度?
C#: Array 1 sort成 Array 2, 怎么从Array 2里的element idx找到原先的idx ?about layout of List in C#
Please help: sort XML with Linqjulia有前途吗? (转载)
python 问题,急,在线等。Python:请问如何把list变成structured array。
被同事吐槽,LINQ用的太多find start point of loop from linked list
Python过去一年利好真不少问个html和c++编程的问题
LINQ+XML适合于什么应用?a simple question
相关话题的讨论汇总
话题: xml话题: list话题: array话题: compare话题: items
进入Programming版参与讨论
1 (共1页)
i****a
发帖数: 36252
1
【 以下文字转载自 DotNet 讨论区 】
发信人: iMaJia (iMac,iPod,iPad,i馬甲), 信区: DotNet
标 题: How to compare data in an Array and in Xml
发信站: BBS 未名空间站 (Wed Feb 8 17:25:48 2012, 美东)
I am coding in C# .NET 3.5
Let's say I have a List, and an XML file with list if items.
What I want to do is compare the values of the two lists, and get the
difference.
I want two results, 1. items in List but not in XML, 2. items in XML but
not in List.
I can only think of looping through the List against XML, and another loop
for XML against the List.
Is there another way to do this quicker?
Also, I've been using Xml.Ling to process the XML on other parts of the
program and wonder if Ling offers anything I can use for this.
l********a
发帖数: 1154
2
it depends what kind of results you are looking for.
if you focus on the content rather than order, then try LINQ
list1.Except(list2)
a9
发帖数: 21638
3
还可以反射看一下except是怎么实现的,哈哈。

【在 l********a 的大作中提到】
: it depends what kind of results you are looking for.
: if you focus on the content rather than order, then try LINQ
: list1.Except(list2)

i****a
发帖数: 36252
4
thank.
so I should port the Xml into a List also?
I guess I'll look at this method and see what it requires

【在 l********a 的大作中提到】
: it depends what kind of results you are looking for.
: if you focus on the content rather than order, then try LINQ
: list1.Except(list2)

1 (共1页)
进入Programming版参与讨论
相关主题
a simple questionpython 问题,急,在线等。
A question about sharing data inside a C++ class被同事吐槽,LINQ用的太多
请教改numpy array的dtypePython过去一年利好真不少
怎么样连接(concatenate)两个list?LINQ+XML适合于什么应用?
how to assign new value to loop variables?how to use array to simulate multi loops
Perl 6 改动很大很恶心怎么判断int a[]的array的实际长度?
C#: Array 1 sort成 Array 2, 怎么从Array 2里的element idx找到原先的idx ?about layout of List in C#
Please help: sort XML with Linqjulia有前途吗? (转载)
相关话题的讨论汇总
话题: xml话题: list话题: array话题: compare话题: items