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

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -