Operator '||' cannot be applied to operands of type

Posted on 2006-05-05
Last Modified: 2008-03-10
I am reciving the following error on the following code can someone please help?

Error  10  Operator '||' cannot be applied to operands of type 'System.Reflection.BindingFlags' and 'System.Reflection.BindingFlags'

object newItem = itemType.InvokeMember("Copy", System.Reflection.BindingFlags.DeclaredOnly || System.Reflection.BindingFlags.Public || System.Reflection.BindingFlags.Instance || System.Reflection.BindingFlags.InvokeMethod, null, item, null);
Question by:wenyonk
    1 Comment
    LVL 25

    Accepted Solution

    Try using a single | (bit-wise OR).  the || in C# is a "short-circuit" OR, meaning in only works to evaluate logical expressions.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now