Windows Develop Bookmark and Share   
 index > Windows Forms General > use linq (lambda expression or other) for this code:
 

use linq (lambda expression or other) for this code:

Hi all,

I want use linq (lambda) for my code:

private static string GetMessageValidationErrorList(ValidationErrorList errores)

{

if (errores == null) return string.Empty;

string mensaje = string.Empty;

if (errores.Count > 0) mensaje += " ";

foreach (ValidationError validationError in errores)

{

mensaje += validationError.PropertyName +

": " + validationError.ErrorMessage + " ";

}

return mensaje;

}

any help, please ?

Thanks in advanced...

Alhambra Eidos Development  Thursday, October 01, 2009 2:24 PM
What did you want to use Linq/lambdas for in this code?

Did you want to replace the for loop and use a lambda expression to concatenate your string? If so, I wrote a blog post on that here:

http://msmvps.com/blogs/deborahk/archive/2009/07/03/lambdas-aggregating-strings.aspx

Please read through all of the comments. One of the posters provided a more efficient technique.

Hope this helps.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Thursday, October 01, 2009 3:43 PM
What did you want to use Linq/lambdas for in this code?

Did you want to replace the for loop and use a lambda expression to concatenate your string? If so, I wrote a blog post on that here:

http://msmvps.com/blogs/deborahk/archive/2009/07/03/lambdas-aggregating-strings.aspx

Please read through all of the comments. One of the posters provided a more efficient technique.

Hope this helps.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Thursday, October 01, 2009 3:43 PM

You can use google to search for other answers

Custom Search

More Threads

• DataGridView - dotted selection rectangle
• ContextSwitchDeadlock was detected
• Detecting when the user has the scroll bar clicked with mouse?
• Localization - Form - TitleBar's ContextMenu and Buttons
• Problem moving control from one Parent control to another
• Changing control's property -> Repaint!
• webbrowser, InvokeScript, ComVisibleAttribute?
• Finding a Control in the GAC
• Using Flowlayout
• Set Combobox.SelectedValue to enum value