Home > Net >  Newcomer help, traverse the related problems.
Newcomer help, traverse the related problems.

Time:09-19

A total of 4 seats.
In the 1-2-3-4,
Known to xiao Ming to take up the position 2 are respectively 2 and 3

Q: how to find out xiao Ming didn't occupy seats? (no. 1 and no. 4)

CodePudding user response:

Int [] array=new int [] {1, 2, 3, 4};
Int [] XM=new int [] {2, 3};

For (int I=0; i {
If (array [I]! XM [0]=& amp; & Array [I]!=XM [1])
{
Console. WriteLine (" xiao Ming didn't account for the seat is {0} ", array [I]);
}
}

Console.ReadKey();

CodePudding user response:

Int [] array=new int [] {1, 2, 3, 4};
Int [] XM=new int [] {2, 3};
Array=array. Except (XM). ToArray ();

CodePudding user response:

Is this for difference set?

Never dull

CodePudding user response:

reference by_ love letter reply: 3/f
is this for difference set?

Except for

Based on the explanation of is
 
Int [] intary=new int [] {1, 2, 3, 4};
Int [] useary=new int [] {2, 3};
Var result=intary. Except (useary);
  •  Tags:  
  • C#
  • Related