return Enum .GetValues( typeof(AnimalCodeType) ) .Cast<AnimalCodeType>() .Where( v => (int)v > 0 ) .Select( v => v.ToString() ) .ToList();
This gives you all but the ant (recommended way):
var animalsWithoutAnt = Enum.GetValues(typeof(AnimalCodeType)).Cast<AnimalCodeType>() .Where(act => act != AnimalCodeType.Ant) .ToList();
or by using the int-value:
var animalsWithoutAnt = Enum.GetValues(typeof(AnimalCodeType)).Cast<AnimalCodeType>() .Where(act => (int)act != 0) .ToList();
- Enum values to string list with filter
- Sort String list with Numeric Values
- Linq Query to Compare with List of string values
- I need to compare list with Datatable and filter values using Linq
- Filter Object List with string array list C# lambda expression
- Filter a list of string with wildcard
- How to filter list of dictionary values with criteria
- EFCore Filter on Property With Contains And List of Values
- Filter a generic list with a dynamic condition string with linq
- Filter a List of Strings and select only one occurance of a string with multiple occurance
- List of class objects - Filter class objects with same values using LINQ
- List or Array of String Contain specific word in Html Source Code
- How do I left join a string List and fill in missing values with zeros
- Solid way to filter lists with different values and list sizes
- Filter LINQ To Entities (EF Core) query by List of HashSet of String and Enum
- Checking a list with null values for duplicates in C#
- Replace string values in list
- Converting enum values into an string array
- Check if a string within a list contains a specific string with Linq
- Sorting a list with null values
- Comparing 2 objects and retrieve a list of fields with different values
- Getting unique values from a list of objects with a List<string> as a property
- How to find key value pair in a dictionary with values > 0 with key matching a certain string pattern?
- Use linq expression to filter a dictionary with a list of keys
- How to create a comma delimited string from distinct list of values using LINQ?
- ModelState create List string with Key + ErrorMessage. (LINQ)
- How do you sort a String List by the number of words matched with an Array in Linq
- convert values of List objects to string
- How to convert Dictionary to List with mixing of values and keys?
- List of objects to Dictionary with distinct keys and selected values
- Grouping a 3 tuple and searching a List of Tuples for a particular value in C#
- using LINQ where(lamdaexp).First and First(lambdaexp)
- WPF C# LINQ: Operator '&&' cannot be applied to operands of type 'string' and 'string' query
- Downcasting and Linq
- MVC LINQ Test repository
- Using Any to check against a list in NHibernate
- Get items with longest description and distinct title c#
- Entity Framework object limitations in aggregate LINQ query
- IQueryable - Statement(s) could not be prepared
- Getting attributes from same-named XDocument elements using LINQ
- Nested If Statement in Linq to SQL Query
- How do I combine two XElements with linq select?
- How could I take 1 more item from Linq's TakeWhile?
- Linq to Entities DateTime Conversion
- Comparing LINQ entities and getting difference
- Compare items in a List to each other, by a seperate function
- Which is more efficient in this case? LINQ Query or FOREACH loop?
- Entity Framework Core 3.1 anonymous projections cannot now be used in Linq include statements?
- Linq check to see is there any NULLs in a set of DataRows?