I'm trying to get all the enum values from the Type enum variable :
[Flags]
    enum Type
    {
        XML = 1,
        HTML = 2,
        JSON = 4,
        CVS = 8
    }
static void Main(string[] args)
{
    Type type = Type.JSON | Type.XML;
    List<Type> types = new List<Type>();
    foreach (string elem in type.ToString().Split(',') )
        types.Add(  (Type)Enum.Parse( typeof(Type), elem.Trim() ) );          
}
Is there a better way to do that ?
 
     
    