首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ZXing -使用泛型类型BarcodeWriter<TOutput>需要1个类型参数ZXing.NET.Mobile

ZXing -使用泛型类型BarcodeWriter<TOutput>需要1个类型参数ZXing.NET.Mobile
EN

Stack Overflow用户
提问于 2019-02-28 10:04:58
回答 2查看 3.9K关注 0票数 1

我一直在尝试使用ZXing.Net.Mobile和ZXing.Net.Mobile.Forms:https://github.com/Redth/ZXing.Net.Mobile生成QRCode,但遇到了以下错误:

"Severity Code Description Project File Line Suppression State Error Active Using the generic type 'BarcodeWriter‘requires 1 type arguments TestApp.Android Active 70 Active“

这是我的代码:

代码语言:javascript
运行
复制
BarcodeWriter writer = new BarcodeWriter()
            {
                Format = BarcodeFormat.QR_CODE,
                Options = new ZXing.Common.EncodingOptions
                {
                    Height = 600,
                    Width = 600
                }
            };

我见过的其他调用BarcodeWriter()的例子还不错,https://csharp.hotexamples.com/examples/ZXing/BarcodeWriter/-/php-barcodewriter-class-examples.html就是其中的几个例子。

为什么调用BarcodeWriter需要类型参数。如何正确实例化BarcodeWriter的实例?

EN

Stack Overflow用户

发布于 2019-02-28 15:05:38

问题是您使用的BarcodeWriter来自错误的名称空间。

您应该使用ZXing.Mobile.BarcodeWriter,而您使用的是ZXing.BarcodeWriter,请尝试以下方法,看看它是否适用于您:

代码语言:javascript
运行
复制
var barcodeWriter = new ZXing.Mobile.BarcodeWriter
        {
            Format = ZXing.BarcodeFormat.QR_CODE,
            Options = new ZXing.Common.EncodingOptions
            {
                Height = 600,
                Width = 600
            }
        };
票数 1
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54917300

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档