Handling Enum flags for a copy operation I've just set up a bit of code to try and make things neater, but all I've really done, is add a whole bunch of nested if statements:

public void Copy(Copy copyType)
{    
    FrmProjectChooser frm = null;
    if (copyType.HasFlag(Copy.Single))
    {
        if (copyType.HasFlag(Copy.Estimations) &amp;&amp; copyType.HasFlag(Copy.SubItems))
        {
            // Single item, with sub items and estimations
            List&lt;WB&gt; items = new List&lt;WB&gt; { (WB)treeWBS.GetDataRecordByNode(treeWBS.FocusedNode) };
            items.AddRange(_WBSManager.GetAllChildren(items[0].idWBS));
            List&lt;CTREstimation&gt; estimations = new List&lt;CTREstimation&gt;();
            foreach (WB wbs in items)
                estimations.AddRange(CTREstimationsManager.Instance.GetEstimationsForWBS(wbs.idWBS));
            frm = new FrmProjectChooser(items, estimations);
        }
        else if (copyType.HasFlag(Copy.Estimations))
        {
            // Single item, with estimations.
            WB wbsItem = treeWBS.GetDataRecordByNode(treeWBS.FocusedNode) as WB;
            if (wbsItem != null)
                frm = new FrmProjectChooser(new List&lt;WB&gt; { wbsItem },
                    CTREstimationsManager.Instance.GetEstimationsForWBS(wbsItem.idWBS));
        }
        else if (copyType.HasFlag(Copy.SubItems))
        {
            // Single item, with sub items
            List&lt;WB&gt; items = new List&lt;WB&gt; { (WB)treeWBS.GetDataRecordByNode(treeWBS.FocusedNode) };
            items.AddRange(_WBSManager.GetAllChildren(items[0].idWBS));
            frm = new FrmProjectChooser(items);
        }
        else
        {
            // Single item
            WB wbsItem = treeWBS.GetDataRecordByNode(treeWBS.FocusedNode) as WB;
            if (wbsItem != null)
                frm = new FrmProjectChooser(new List&lt;WB&gt; {wbsItem});
        }
    }
    else if (copyType.HasFlag(Copy.All))
    {
        if (copyType.HasFlag(Copy.Estimations))
        {
            // All items, with estimations.
            List&lt;WB&gt; wbsItems = _WBSManager.GetWBSForProject(CurrentProject.idProjects);
            List&lt;CTREstimation&gt; estimations = new List&lt;CTREstimation&gt;();
            foreach (WB wbs in wbsItems)
                estimations.AddRange(CTREstimationsManager.Instance.GetEstimationsForWBS(wbs.idWBS));
            frm = new FrmProjectChooser(wbsItems, estimations);
        }
        else
        {
            // All items
            frm = new FrmProjectChooser(_WBSManager.GetWBSForProject(CurrentProject.idProjects));
        }
    }

    if (frm != null)
        frm.ShowDialog();
}

[Flags]
private enum Copy
{
    None = 0,
    Single = 1, // Straight copy of single item
    SubItems = 1 &lt;&lt; 1, // Include any children in the copy
    Estimations = 1 &lt;&lt; 2, // Include estimations in the copy
    All = 1 &lt;&lt; 3 // Copy all items
}


The code will pull "Items" from a TreeList. "Sub Items" are of the same type as "Items", but Estimations are a different type. I don't think it's very neat. I've tried googling similar titles to this question but I can't really find anything that helps. 

Is there anything I can do to make this neater?
For an aesthetic point of view, you could define some constants:

AllEstimations = Copy.All | Copy.Estimations
SingleEstimations = Copy.Single | Copy.Estimations
etc. 


You could then check the value against these constants and create a single level if statement:

if (copyType == SingleEstimationsSubItems)
{}
elseif (copyType == SingleEstimations)
{}
elseif (....


I'm not claiming this will improve performance, but it will make the code more readable.