ZXing - 使用泛型类型 BarcodeWriter<TOutput>需要 1 个类型参数 ZXing.NET.Mobile [英] ZXing - Using the generic type BarcodeWriter<TOutput> requires 1 type argument ZXing.NET.Mobile
问题描述
我一直在尝试使用 ZXing.Net.Mobile 和 ZXing.Net.Mobile.Forms 生成二维码:https://github.com/Redth/ZXing.Net.Mobile 来了跨越以下错误:
I have been trying to generate a QRCode using ZXing.Net.Mobile and ZXing.Net.Mobile.Forms: https://github.com/Redth/ZXing.Net.Mobile and have come across the following error:
"Severity Code Description Project File Line Suppression State错误 CS0305 使用泛型类型BarcodeWriter"需要 1 个类型参数 TestApp.Android G:\Tests\TestApp\TestApp\TestApp.Android\SelectedBookingPage.cs 70 Active"
"Severity Code Description Project File Line Suppression State Error CS0305 Using the generic type 'BarcodeWriter' requires 1 type arguments 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 列出一些.
Other examples I have seen call BarcodeWriter() like above just fine, https://csharp.hotexamples.com/examples/ZXing/BarcodeWriter/-/php-barcodewriter-class-examples.html to list a few.
为什么调用 BarcodeWriter 需要类型参数.如何正确实例化 BarcodeWriter 的实例?
Why does calling BarcodeWriter require a type argument. How can I properly instansiate an instance of a BarcodeWriter?
推荐答案
我解决了这个问题.BarcodeWriter 在 android 项目中本机使用时可以按预期实例化,在我最初的问题中,我试图在项目的跨平台 Xamarin 部分中使用它.
I fixed the issue. BarcodeWriter can be instantiated as expected when used natively in the android project, in my original question I was attempting to use it within the cross platform Xamarin part of the project.
这篇关于ZXing - 使用泛型类型 BarcodeWriter<TOutput>需要 1 个类型参数 ZXing.NET.Mobile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!