Q:

Casting an enum works when declaring a specific enum entry, but not when retrieving from a dictionary

When one declares an enumeration with a base type uint, it is possible to cast it to an int when you know exactly which item you are converting.  However, when you have a Dictionary and retrieve one of the enum items from it, you cannot do this cast. 
Why does this happen? 
For example:
Enum:
public enum IncrementScheduleMask
{
    Sunday = 0x01,
    Monday = 0x02,
    Tuesday = 0x04,
    Wednesday = 0x08,
    Thursday = 0x10,
    Friday = 0x20,
    Saturday = 0x40,
}

This will work:
bool Sun = true;
ulong weeklyMask = 0;
if (Sun)
    weeklyMask |= (int)IncrementScheduleMask. Sunday;

But this wont:
public static List<string> DaysOfTheWeek = new List<string>{
    "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};

public static Dictionary<string, IncrementScheduleMask> DaysOfTheWeekMasks = new Dictionary<string, IncrementScheduleMask>()
{
    { "Sun", IncrementScheduleMask. Sunday },
    { "Mon", IncrementScheduleMask. Monday },
    { "Tue", IncrementScheduleMask. Tuesday },
    { "Wed", IncrementScheduleMask. Wednesday },
    { "Thu", IncrementScheduleMask. Thursday },
    { "Fri", IncrementScheduleMask. Friday },
    { "Sat", IncrementScheduleMask. Saturday }
};

ulong weeklyMask = 0;
Action<string> _CompileWeekDays = new Action<string>(dayName =>
{

        IncrementScheduleMask iMask = DaysOfTheWeekMasks[dayName];

        weeklyMask |= (int)iMask;
});
DaysOfTheWeek. ForEach(_CompileWeekDays);

I've already gone ahead with another solution, but I wanted to know why one works and not the other.  If you should not be able to cast like this, then shouldn't it be the same both ways? 

A:

Your enum is based on int, not uint as you claim. 
The difference between the two situations is that in the first one you have a constant conversion.  You can convert from int to ulong implicitly with constants (literals) because the compiler can see that the values are non-negative. 
In the second case, you don't have compile-time constants.  Therefore the conversion from int, a type that could be negative, to ulong, a non-signed type, must be explicit, not implicit. 
In both cases, it is natural to change the (int) cast to (ulong). 

Here's a simpler example:
// will work:
const int e = 1;
ulong weeklyMask = e;  // OK from int to ulong, constant

Versus:
// will not work:
int e = 1;
ulong weeklyMask = e;  // illegal from int to ulong, needs explicit cast

