I have a LINQ query:
var result = (from CC in hc.ClaimCodings
join CM in hc.ClaimCodingProcedureCodeModifierXrefs on CC.ClaimCodingID equals CM.ClaimCodingID
join PCM in hc.ProcedureCodeModifiers on CM.ProcedureCodeModifierID equals PCM.ProcedureCodeModifierID
where CC.CTCustomerSubID == custSub && CC.ClaimID == claimID
select new { PCM.ModifierCode });
EDIT
Which can return 0 to 4 items. I want to set the value of each Modifier code to a property:
public string ModCode1 { get; set; }
public string ModCode2 { get; set; }
public string ModCode3 { get; set; }
public string ModCode4 { get; set; }
Modcode1 = result.ModifierCode.getindex(0).firstordefault();
ModeCode2 = second result's ModifierCode;
etc
etc
Unless I’m approaching this completely wrong. I’m not so good with LINQ yet 🙁
Is this what you have in mind?
Main changes:
PCM.ModifierCode != nullcheck within LINQ query.List<string>throughToList().However, as BrokenGlass said, you’re probably better off storing a list.