If all you're doing is looking to coerce that string for display purposes (and don't care about preserving the text in dues_text for other purposes, try this out:
public IQueryable GetDues()
{
return from dues in ObjectContext.tblDuesRates
orderby dues.due_type
let dueText = string.Format("{0} - {1}", dues.due_type, dues.amount.Value)
select new pmDues
{
DuesID = dues.id,
dues_type = dueText,
dues_amount = dues.amount.Value
};
}
All we're doing is concating with string.Format. The let allows an inline value to be constructed. This also helps it to be a little more readable.
Also, how is it not working? Are you getting an error? It might be that dues.amount.Value is null, which would throw an exception.
Alternatively, if you are looking to create something that is always accessible and you want to preserve the value of dues_type, create a read-only property on your class that does the same string.Format to return the other two properties.
Cheers,
-James