Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# how to check if two lists have same values

var list1 = new List<int> { 1, 2, 3, 1 };
var list2 = new List<int> { 2, 1, 3, 1 };
var list3 = new List<int> { 2, 2, 3, 2 };
bool areTheSame1 = list1.SequenceEqualsIgnoreOrder(list2); //True
bool areTheSame2 = list1.SequenceEqual(list2); //True
bool areTheSame3 = list1.SequenceEqual(list3); //False
Comment

check two lists are equal c#

List<int> list1 = new List<int> { 1, 2, 3 };
List<int> list2 = new List<int> { 1, 2, 3 };

if (list1.SequenceEqual(list2))
{
  Console.WriteLine("true");
}
else
{
  Console.WriteLine("false");
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: tests not showing in test explorer 
Csharp :: ef core detach entity 
Csharp :: c# string to hex 
Csharp :: access a local varible in a different function C# 
Csharp :: c# dictionary first 
Csharp :: small modal popup bootstrap 
Csharp :: The terminal process failed to launch: Path to shell executable "dotnet" is not a file or a symlink. 
Csharp :: c# winforms textbox to int 
Csharp :: run linux command in c# 
Csharp :: rb.addforce c# 
Csharp :: Prevent player rotation unity 
Csharp :: c# date 
Csharp :: photon rpc 
Csharp :: c# bcrypt 
Csharp :: dotnet ef migrations to folder 
Csharp :: c# afficher texte 
Csharp :: json.net deserialize dynamic 
Csharp :: VLC .net 
Csharp :: c# get the last item in a list 
Csharp :: triangle minimum path sum c# 
Csharp :: make window not resizable wpf 
Csharp :: c# console foreground color 
Csharp :: c# find process by name 
Csharp :: how to get hours and minutes from second in c# 
Csharp :: rotating an object in unity 
Csharp :: c# unity get name of object 
Csharp :: const class in c sharp 
Csharp :: if in dictionary c# 
Csharp :: total months between two dates c# 
Csharp :: Install Mono project on Ubuntu 20.04 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =