ZXing - 使用泛型类型 BarcodeWriter<TOutput>需要 1 个类型参数 ZXing.NET.Mobile [英] ZXing - Using the generic type BarcodeWriter&lt;TOutput&gt; requires 1 type argument ZXing.NET.Mobile

查看:203
本文介绍了ZXing - 使用泛型类型 BarcodeWriter<TOutput>需要 1 个类型参数 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/-/p​​hp-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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆