Are there any disadvantages or performance slowdowns related to the use of expressions like
from i in Enumerable.Range(1, Math.Min(strTexto.Length, tamMax) + 1)
select Tuple.Create(strTexto.Substring(0, i - 1), strTexto.Substring(i - 1))
in C#? Is it preferable to build "hard-coded queries" like
foreach (Int32 IntTmp in SomeListWithTheRange)
SomeListWithTheTuples.Add(new Tuple<String, String> (strTexto.Substring(0, i - 1), strTexto.Substring(i - 1)))
?
While the first one seems more readable at first glance, I have noticed that this kind of queries can get very slow... For instance, the first query takes 11ms to perform, while the second one takes only 1ms. Am I right? Just want to make sure since I need to implement lots of these kind of queries.