我一直在尝试使用 ZXing.Net.Mobile 和 ZXing.Net.Mobile.Forms 生成 QRCode:https://github.com/Redth/ZXing.Net.Mobile并遇到以下错误:
》严重性代码描述项目文件行抑制状态
错误 CS0305 使用通用类型“BarcodeWriter”需要 1 个类型参数 TestApp.Android G:\Tests\TestApp\TestApp\TestApp.Android\SelectedBookingPage.cs 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 的实例?
如果您将 ZXing.Net 与 .Net Standard 一起使用,则必须添加一个附加包,其中包含您要使用的图像处理库的条形码读取器和写入器类的特定实现。
例如,在 Windows 上,您需要使用此包:https://www.nuget.org/packages/ZXing.Net.Bindings.Windows.Compatibility/
更多信息在这里:https://github.com/micjahn/ZXing.Net/issues/370
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)