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:
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
Post a Comment