[Solved] Linq to find the length of the value of the column in the list [closed]


I give it a try, though a lot of questions are open (what type of list, what a column, …).

In short: you can use String.Insert to insert text at a specified postition.

Assuming you have a List<Foo>, the class Foo has a string property Value (your column). If it’s Length exceeds 100 the line should be wrapped:

foreach(Foo foo in foos)
{
    if(foo.Value.Length > 100)
        foo.Value = foo.Value.Insert(100, Environment.NewLine);
}

http://msdn.microsoft.com/en-us/library/system.string.insert.aspx

Here’s running code with sample data.

http://ideone.com/sUKLk

solved Linq to find the length of the value of the column in the list [closed]