首先,设置要比较的两个数组 -
// two arrays int[] arr = new int[] { 99, 87, 56, 45}; int[] brr = new int[] { 99, 87, 56, 45 };
现在,使用 SequenceEqual() 比较两个数组 -
arr.SequenceEqual(brr);
以下是比较两个数组的代码 -
using System; using System.Linq; namespace Demo { class Program { static void Main(string[] args) { // two arrays int[] arr = new int[] { 99, 87, 56, 45}; int[] brr = new int[] { 99, 87, 56, 45 }; // compare Console.WriteLine(arr.SequenceEqual(brr)); } } }
以上就是C#中如何比较两个数组?的详细内容,更多请关注php中文网其它相关文章!
已抢187105个
抢已抢67504个
抢已抢353783个
抢已抢668477个
抢已抢123896个
抢已抢26097个
抢