i'm looking concise 1 line method single value datatable
using lambda using vb.net
this code works
opt_udly = (from x in data.options x.contract = ctc select x.udly).single()
but i'd value in 1 line (which doesn't work)
opt_udly = data.where(function(t) t.contract.equals(ctc)).distinct()
any suggestions please?
try this:
opt_udly = data.options.where(function(t) t.contract = ctc).select(function(x) x.udly).single()
- since use
data.options
in multiple linq lines, should consistently used single line too. - also, since need
udly
element, use furtherselect
linq
expression in single line style, did in multiple lines. - and lastly, use
single
return matching value if there 1 match, did.
Comments
Post a Comment