I am trying to make Boolean value as true if the main list does not contain newly added 2nd items list.
static void Main()
{
List<int> toUserIds = new List<int>() { 1,3,4,5};
List<int> fromUserIds = new List<int>() { 6,1,4,3,5};
bool isMDNUpdated = false;
foreach (int userID in fromUserIds)
{
if (toUserIds.IndexOf(userID) == -1)
{
isMDNUpdated = true;
break;
}
}
Console.WriteLine(isMDNUpdated);
Console.Read();
}
What I have tried:
I have tried with the below code.
Could you please correct me if this code is not in proper way.
static void Main()
{
List<int> toUserIds = new List<int>() { 1,3,4,5};
List<int> fromUserIds = new List<int>() { 6,1,4,3,5};
bool isMDNUpdated = false;
foreach (int userID in fromUserIds)
{
if (toUserIds.IndexOf(userID) == -1)
{
isMDNUpdated = true;
break;
}
}
Console.WriteLine(isMDNUpdated);
Console.Read();
}