score:12
Accepted answer
var isAllInts = lst.All(x => x is int);
score:2
As @Igor Mentioned You can do this
var isAllInts = lst.All(x => x is int);
But just incase you want to see if the string is an int aswell you can
int testVal = 0;
var isAllInts = lst.All(x => int.TryParse(x.ToString(), out testVal));
Source: stackoverflow.com
Related Query
- Check if List<object> contains all integers
- Check if one IEnumerable contains all elements of another IEnumerable
- Check if a list contains all of another lists items when comparing on one property
- Check if one list contains all items from another list in order
- Lambda check if list contains certain property values on all properties
- c# Linq - Get all elements that contains a list of integers
- Check if a collection contains ALL values from another collection with Deferred Execution
- Check if HUGE dictionary contains a string and get all elemets that match element
- How to check if one list contains all elements of another list in linq to sql statement
- check if a list contains all the element in an array using linq
- Check if list contains element that contains a string and get that element
- How to check if all list items have the same value and return it, or return an “otherValue” if they don’t?
- Determine if a sequence contains all elements of another sequence using Linq
- How to check list A contains any value from list B?
- Check if list contains item from other list in EntityFramework
- The source contains no DataRows
- Sequence contains no elements error but I want to check for null
- Check if a string within a list contains a specific string with Linq
- How to use Linq to check if a list of strings contains any string in a list
- How to check if any word in my List<string> contains in text
- Determine if Dictionary Contains All of a Set of Keys
- Check that all items of IEnumerable<T?> has the same value using LINQ
- check whether a List<string> contains an element in another List<string> using LINQ
- Check if a string contains only letters, digits and underscores
- Find all items whose collection property contains items in another list
- How to check if all values in an array are equal
- Check if a String value contains any number by using Lambda Expression
- Check if a string contains particular characters in any order
- Is it possible to use LINQ to check if all numbers in a list are increasing monotonically?
- Check if all items in a Collection have the same value
More Query from same tag
- Linq and a select with two tables
- Mapping Linq Group By Results To An Object
- linq 'not in' query not resolving to what I expect
- Get 1 record from 2 tables ASP.NET
- EF core eager loading - loads same data multiple times
- check that a specific user has specific permission in lightswitch
- Multiple JLeft Outer Join in LINQ
- Could not find an implementation of the query pattern for source type 'System.Data.Entity.DbSet'
- Loop over parameters to generate LINQ at runtime
- C# write to file inside linq query
- Creating a dynamic xml document
- Filtering data based on data through multiple relationships
- Buffering versus streaming a large dataset
- If IQueryable<T> inherits IEnumerable<T> , how come IQueryable<T> is LINQ to SQL?
- linq marge duplicate values
- C # Linq equivalent of SQL nested group by
- Update XML with C# using Linq
- EF Lambda include navigation properties
- LINQ Max() in the list inside the list
- expression trees linq get value of a parameter?
- c#Linq To XML Same element names
- Trying to parse XML and create a List information using Linq and C#
- How To Know If A Certain Form Is Open?
- Change in value based on criteria with LINQ
- Need to add xml element to last parent using linq c#
- List Custom Sort
- C# getting sorted list of images
- How to identify if two List<string> are equal regardless of the order?
- Add undetermined number of AND on Linq-SQL Query?
- Defining a one-to-one relationship in SQL Server