Get Enum Values from int
<p>How can get the enum values from an int input?
Let's say I have this enum below.</p>

<pre><code>[Flags]
public enum Weeks
{
    Sunday = 1,
    Monday = 2,
    Tuesday = 4,
    Wednesday = 8,
    Thursday = 16,
    Friday = 32,
    Saturday = 64
}

public List&lt;Weeks&gt; GetEnumValues(int input)
{
    // Don't know what is the logic here
    // Help is much appreciated
}
</code></pre>

<p>Then the output is as follows</p>

<pre><code>Examples:
1.) input = 3; This means Sunday and Monday hence 1 + 2 = 3; This should return List&lt;Weeks&gt; { Sunday, Monday }
2.) input = 20; This means Tuesday and Thursday hence 4 + 16 = 20; This should return List&lt;Weeks&gt; { Tuesday, Thursday }
3.) input = 40; This means Wednesday and Friday hence 8 + 32 = 40; This should return List&lt;Weeks&gt; { Wednesday, Friday }
</code></pre>

<p>Thank you in advance.</p>