Have a placeholder of the right type:
IQueryable<CommunicationGroupConfiguration> temp = null;
if(some condition)
{
temp = config.PromoRegistration.Communications.Cast<CommunicationGroupConfiguration>();
}
else
{
temp = config.Subscriptions.Cast<CommunicationGroupConfiguration>();
}
comms =
(from s in temp
from c in s.Communications.Cast<CommunicationConfiguration>()
where s.CurrentBrand == true
select c).ToList().FirstOrDefault();
Or you could use the ternary operator (which is cleaner in my opinion):
comms =
(from s in (<some condition> ? config.PromoRegistration.Communications : config.Subscriptions).Cast<CommunicationGroupConfiguration>()
from c in s.Communications.Cast<CommunicationConfiguration>()
where s.CurrentBrand == true
select c).ToList().FirstOrDefault();