score:2

Accepted answer

You can use the overloaded Enumerable.Select method to include the index, then use ToDictionary:

var dict = EventOccurrencesMappedToPatientMeds
               .Select((e, i) => new { Event = e, Index = i + 1 })
               .ToDictionary(o => o.Index,
                             o => (ScheduleEventOccurrenceMedPair)o.Event);

score:1

Use ToDictionary extension method.

Something like this:

var i = 1;
var resultDictionary = (
    from pm in allPtMeds
    from e in thisUsersEventOccurrencesPlusEventData
    where e.EventContainer.Event.PatientMedId == pm.MedicationId
    select new ScheduleEventOccurrenceMedPair
    {
        PatientMedication = pm,
        ScheduledEventOccurrence = e.EventOccurrence
    })
    .ToDictionary(arg => i++, arg => arg);

Related Articles