Reputation: 148
I have a class
public class IgonoreValues
{
internal static List<string> IgonoreValuesList = new List<string>
{
"Merge: ","# Conflicts:"
};
}
it has a list of strings.
Now I have a String ChangeSetInfo it contains
commit 1084b2a815b47fb03632e5bc32a0468ceb1d4bf5
Author: shw<[email protected]>
Date: Wed Jun 23 09:36:34 2021 +0530
Manager Merge:
A Manager/EventCollectionManager.cs
A Manager/EventCollectionTimer.cs
A Manager/EventManager.cs
A Manager/GitManager.cs
I want to execute a linq command line for if (!ChangeSetInfo.Contains("Merge: ") || !ChangeSetInfo.Contains("# Conflicts:"))
can any one tell me a way to do this?
Upvotes: 1
Views: 62
Reputation: 460308
Maybe you want to check if the string contains any of those ignore-strings. Then use Any
:
if (!IgonoreValues.IgonoreValuesList.Any(ChangeSetInfo.Contains))
{
// ...
}
the case insensitive variant:
if (!IgonoreValues.IgonoreValuesList.Any(iv => ChangeSetInfo.Contains(iv, StringComparsion.OrdinalIgnoreCase)))
{
// ...
}
Upvotes: 2
Reputation: 129
Try this if(!IgonoreValues.IgonoreValuesList.Any(o => ChangeSetInfo.Contains(o)))
Upvotes: 1