📅  最后修改于: 2022-03-11 14:48:56.648000             🧑  作者: Mango
static void Main(string[] args)
{
int[] arr = { 1, 3, 4, 9, 2 };
int numToRemove = 3;
var numIndex = arr.Where(x=>x ==numToRemove);
if(numIndex.Any()){
var idx = Array.IndexOf(arr,numToRemove);
var remove = arr.Remove(idx);
}
}