c# - how to add condition in object declaration ? EF - -
i (below)... don't want full write out template.title = xxx, template.descrption =xxx etc.
but can't compile, because condition not correct. seems can add condition this
(lang == "e") ? doctype = "spot-ii: " : doctype = "spot-iiii " within declaration
etc...
does know how (lang=="e") condition working below?
foreach (var item in s) { template = new rsstemplate() { title = item.titre, description = item.description, (lang == "e") ? doctype = "spot-ii: " : doctype = "spot-iiii " }; t.add(template); }
maybe work:
foreach (var item in s) { template = new rsstemplate() { title = item.titre, description = item.description, doctype = (lang == "e") ? "spot-ii: " : "spot-iiii " }; t.add(template); }
Comments
Post a Comment