Search code examples
c#zxing

How to add "using Zxing" in source code?


I am new to c#. currently I am trying to decode qr code via webcam, I have taken an example from the internet and re written it to try to understand the code. my question is How do I add using Zxing instead of using com.google.zxing?

I know that I should add a reference, but I try to add all the references I know but still it wouldnt allow me to add 'using Zxing'. it only allow 'using com.goggle.zxing' [ I use zxing.dll] as reference

Another problem is compiler error at var reader = new BarcodeReader(); I belief its related to the 'using Zxing" or unknown reference

I really need help on this matter. Kindly show me how to solve or where can I find the Zxing reference. thanks again.


Solution

  • Simply put, you don't.

    The library uses a namespace of com.google.zxing, so that's what you need to specify in the using directive. You don't get to change that namespace, unless you want to fetch the source code, change all the namespace declarations and rebuild. Why would you want to specify a different namespace in the using directive? What benefit do you think you'd achieve?

    Of course you don't have to use a using directive at all. You could specify the full name of each type. For example:

    com.google.zxing.MultiFormatReader reader = new com.google.zxing.MultiFormatReader();
    

    But it would be much more sensible to use:

    using com.google.zxing;
    
    // Later in the code
    MultiFormatReader reader = new MultiFormatReader();