# C# 匹配两个数组不同的值除遍历

0
[已解决问题] 解决于 2011-08-16 09:50

var arr1=new string[]{'1','2','3','4','5'}

var arr2=new string[]{'1','2','3','4'}

sixserve | 初学一级 | 园豆：21

0

`var arr1 = new string[] { "1", "2", "3", "4", "5" };            var arr2 = new string[] { "1", "2", "3", "4" };            var result = arr1.ToList().Where(s => !arr2.ToList().Contains(s));            result.ToList().ForEach(                s=>Console.WriteLine(s)                );`

artwl | 专家六级 |园豆：16536 | 2011-08-03 16:05

sixserve | 园豆：21 (初学一级) | 2011-08-03 16:11

0

var arr2=new string[]{'1','2','3','6'}

string[] arr1=new string[]{"1","2","3"};
string[] arr2=new string[]{"1","2","3","6","10","22"};
string[] arr3=new string[arr1.Length];
int q=0;
string[]arr4;
string[] arr5;
arr4=arr1;
arr5=arr2;
if(arr1.Length {
arr4=arr2;
arr5=arr1;
}
if(arr1.Length!=arr2.Length)
{
for(int i=0;i {
for(int j=0;j {
if(arr4[i]==arr5[j])
{
break;
}
if((j+1)==arr5.Length)
{
string aa=arr4[i];
arr3[q]=aa;
q++;
}
}
}
}
for(int i=0;i {

Response.Write(arr3[i]+",");
}

0

if(arr1.Length>arr2.Length)
{
for (int i = arr2.Length; i < arr1.Length; i++)
{

}
}
else
{
for (int i = arr1.Length; i < arr2.Length; i++)
{

}
}

for(int i=少的数组的长度;i<多的数组长度;i++)

0

う三余无梦生 | 园豆：201 (菜鸟二级) | 2011-08-03 17:25

您需要登录以后才能回答，未注册用户请先注册