score:2
Accepted answer
you're very close;
int ma = new[] {svar1, svar2, svar3, svar4, svar5}
.max(lst => lst.max(str => str.length));
should work.
score:1
you can use concat instead of creating new list:
svar1.concat(svar2).
concat(svar3).
concat(svar4).
max(str => str.length);
this solution may be slightly faster if you have many short lists.
Source: stackoverflow.com
Related Query
- Better way of finding longest string length in multiple lists
- Better way to write this C# Code For List of Lists
- Is there a better way to split this string using LINQ?
- Efficient way to unindent lines of code stored in a string
- Merge equal items with multiple lists but different length
- Code Cleanup: Best way to split long statement over multiple lines
- LINQ: A better way to grouping a list of objects by multiple properties in to a list of lists?
- Better way of searching through lists than using foreach
- Better way of comparing two lists with LINQ?
- Accessing a List multiple times in same code block - Any better approach?
- Efficient way of finding multiple dates per ID
- How to code this LINQ query in a better way
- Is there a better way to code this LINQ fragment?
- C# LINQ Find List Inside Another List, Better way to code this than a foreach loop
- Is there a better way to code this Duplicate ID Checker?
- The correct way to calculate the length of a numeric string
- Is there a better way (fastest) to get the longest common folder path?
- What is the best way to find length of split characters from the given string by using String.Split() Method or Linq Lambda Expression in C#
- Is there a better way to achieve this with Linq or a better code
- List or Array of String Contain specific word in Html Source Code
- Is there a better way to group by multiple columns in vb.net
- better way of linq multiple joins?
- Join multiple lists and get output as comma separated string
- Better way to search a List for a string
- Order list of entities which have lists by string length in inner list
- Is there better way to make list into list of lists C#
- Check if multiple sub lists are present in a source list
- Is there a more compact/better way to ZIP multiple lists using LINQ in C#?
- Is there a better way to force LINQ-TO-SQL string comparison to be Case Insensitive?
- Fast way to put 2 lists of String arrays into a DataTable?
More Query from same tag
- Linq to NHibernate generating 3,000+ SQL statements in one request!
- How select in multitable a single column where the price is greater than "0"?
- Translate LINQ Inline query to extension method
- One to Many query, Linq, Entity Framework
- entity framework / linq query construction
- Combining Multiple LINQ Queries as OR statements in each query
- How to convert linq expression to dictionary<string,string>
- Select item from one list based on item in another list in the same order
- Accessing instance field inf foreach removes instance
- Count instances of element in c# list
- C# SQL to LINQ pattern matching
- Wrapping LINQ query to a Repeater
- Why can't I reorder collection properties of this linq to sql object?
- TakeWhile, but I want the rest of the input sequence as well
- C# Linq- How to manage paging of a parent child query?
- converting c# lambda expression LINQ to vb.net
- Group List of objects based on substring in one of the fields
- Icollection does not contain a defintion for any
- how to build Expression<Func<x,y>> with no input parameters?
- NHibernate List - Unable to cast object of type System.Collections.Hashtable
- How to access the query variable
- How to get minimum from multiple date columns in linq?
- What's the story with ExpressionType.Assign?
- Gridview is not binding properly:
- Getting count of values in dictionary using LINQ
- Select Linq-to-XML from Linq-to-Entities?
- Populating classes with many to many linq data
- Recommended way to convert IGrouping<TKey, TValue> to IDictionary<TKey, IEnumerable<TValue>>
- Net Core: Find Data Type for any Variable Field in Class
- Should parameters/returns of collections be IEnumerable<T> or T[]?