c# - Why the LINQ method `Where` in my code is wrong for string[]? -


.net 3.5

i simple linq operation:

using system.linq; ... /* extract product key. i.e. "acad-7001:  * 409" "software\autodesk\autocad\r17.2\acad-  * 7001:409". ignore last '\' char if   * exists. */ string product_code = subkey_name.split('\\').where     (n -> n != string.empty).last(); 

but compilation error:

enter image description here

hm... in code use linq-method where. whot wrong?

instead of

where     (n -> n != string.empty) 

use

where     (n => n != string.empty) 

(so replace -> => correct syntax)

but i'd prefer this:

.where(n => !string.isnullorempty(n)) 

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -