C# How to compare two arrays and find the same or different elements
This article example describes how C# compares two arrays and finds the same or different elements. Share it for your reference, as follows:
string[] arr1 = new[] { "1", "2", "3", "4", "5" }; string[] arr2 = new[] { "1", "3", "5" }; var sameArr = (arr2).ToArray(); //Find out the same element (i.e. intersection)var diffArr = (c => !(c)).ToArray(); //Find out different elements (i.e., the complement of intersections)
I hope this article will be helpful to everyone's C# programming.
Related Articles
C# implementation pop-up window prompts to enter password
This article mainly introduces the C# implementation pop-up window to prompt you to enter the password. The sample code in the article is introduced in detail and has a certain reference value. Interested friends can refer to it.2022-02-02C# method to obtain system version information
Today, it is an example to obtain system version information. The method of obtaining it is very simple. Friends who need it can refer to it.2012-11-11Detailed explanation of C# XmlDocument operation XML case
This article mainly introduces a detailed explanation of the C# XmlDocument operation XML case. This article explains the understanding and use of this technology through brief cases. The following is the detailed content. Friends who need it can refer to it.2021-08-08Detailed explanation of the connections and differences based on C# classes, interfaces, and structures
This article provides a detailed analysis and introduction to the connection and differences between classes, interfaces and structures in C#. For those who need it, please refer to it.2013-06-06C# parses Excel and generates Csv file code analysis
This article mainly introduces the methods and code sharing of C# parsing Excel and generating Csv files. Friends in need can refer to it.2014-10-10Detailed introduction to new keywords in .net(c#)
In C#, the new keyword can be used as an operator, modifier, or constraint2013-10-10How to monitor folder changes in C#
This article mainly introduces the method of C# to monitor folder changes. It is a very practical technique to monitor folders through the FileSystemWatcher class method. Friends who need it can refer to it.2014-11-11Use the XmlDocument class in C# to create and modify XML format data files
This article mainly introduces the method of using the XmlDocument class in C# to create and modify XML-format data files. The XmlDocument class is included in the .NET framework. Friends who need it can refer to it.2016-04-04C# Super high interview questions collection and sorting
C# super high interview questions, friends who study C sharp can read them, which explain the shortcomings. Do all problems have their own solutions?2010-03-03C# implements reading txt files to generate Word documents
Hello everyone, this article mainly talks about C# realizing the implementation of reading txt files to generate Word documents. Interested students should take a look. If it is helpful to you, remember to bookmark it.2022-01-01