Best practice for checking for an enum flag (C#)
I noticed these two patterns for checking for an enum flag:

<!-- language: lang-cs -->

    [Flags]
    public enum PurchaseType
    {
        None = 0,
        SalePrice = 2,
        RegularPrice = 4,
        Clearance = 8,
        CreditCard = 16
    }

    public void Test()
    {
        PurchaseType type = PurchaseType.Clearance;
        type |= PurchaseType.CreditCard;

        // Practice 1
        if ((type & PurchaseType.Clearance) == PurchaseType.Clearance)
        {
            // Clearance item item handling
        }

        // Practice 2
        if ((type & PurchaseType.CreditCard) != 0)
        {
            // Credit card item handling   
        }
    }

Of the two ways of checking for an enum flag, which one is better and why?

Thanks,
Mohammed
Best practice for checking for an enum flag (C#)
===

I noticed these two patterns for checking for an enum flag:

<!-- language: lang-cs -->

    [Flags]
    public enum PurchaseType
    {
        None = 0,
        SalePrice = 2,
        RegularPrice = 4,
        Clearance = 8,
        CreditCard = 16
    }

    public void Test()
    {
        PurchaseType type = PurchaseType.Clearance;
        type |= PurchaseType.CreditCard;

        // Practice 1
        if ((type & PurchaseType.Clearance) == PurchaseType.Clearance)
        {
            // Clearance item item handling
        }

        // Practice 2
        if ((type & PurchaseType.CreditCard) != 0)
        {
            // Credit card item handling   
        }
    }

Of the two ways of checking for an enum flag, which one is better and why?

Thanks,
Mohammed