Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lambda Expression: CS to VB.Net

Tags:

c#

vb.net

lambda

I am dumb founded at this statement....maybe its just too many hours/days of doing C# to VB.Net conversion but i am drawing a blank on this conversion.

Any help would be greatly appreciated.

List<string> sColors = new List<string>(this.CustomPaletteValues.Split(','));
try {
   List<Color> colors = sColors.ConvertAll<Color>(s => (Color)(new ColorConverter().ConvertFromString(s)));    

What i have so far:

Dim colors As List(Of Color) = sColors.ConvertAll(Of Color)(....)

As you can see its the content of the lambda that i am hitting a brick wall with.

like image 970
GoldBishop Avatar asked Jul 26 '26 06:07

GoldBishop


1 Answers

Pardon the line breaks, but I believe this is what you want.

Dim colors As List(Of Color) = sColors.ConvertAll(Of Color)(
    Function(s) DirectCast((New ColorConverter).ConvertFromString(s), Color)
)
like image 88
Adam Maras Avatar answered Jul 27 '26 20:07

Adam Maras



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!