我一直在尝试使用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“
这是我的代码:
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的实例?
发布于 2019-02-28 15:05:38
问题是您使用的BarcodeWriter来自错误的名称空间。
您应该使用ZXing.Mobile.BarcodeWriter
,而您使用的是ZXing.BarcodeWriter
,请尝试以下方法,看看它是否适用于您:
var barcodeWriter = new ZXing.Mobile.BarcodeWriter
{
Format = ZXing.BarcodeFormat.QR_CODE,
Options = new ZXing.Common.EncodingOptions
{
Height = 600,
Width = 600
}
};
https://stackoverflow.com/questions/54917300
复制相似问题