获取错误无法推断公共类型,因为可能有多种类型 [英] Getting Error Can not infer Common Type because more than one type is possible

查看:140
本文介绍了获取错误无法推断公共类型,因为可能有多种类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在For Each循环中使用表达式并获得错误:"无法推断出常见类型,因为可能有多种类型"

I am using expression in For Each loop and getting Error : "Can not infer common type because more than one type is possible"

这是表达式。 WsResponse基本上是webservice的输出参数,包含base64String。

This is expression. WsResponse is basically output parameter of a webservice and contains base64String.

if(wsResponse.item,Enumerable.Empty(Of Byte)())。ToArray()

If(wsResponse.item, Enumerable.Empty(Of Byte)()).ToArray()

有人可以提供帮助吗?

推荐答案

设置代码顶部选项推断关闭并解决相关警告对此。 

Set in top of your code Option Infer Off and solve the warning related to this. 

并且很可能你有Option Strict Off,所以invering给出了简单的对象。因此,请在代码顶部将其设置为"开"

And most probably you have Option Strict Off so invering gives simple object. Therefore set that to On in top of the code 


这篇关于获取错误无法推断公共类型,因为可能有多种类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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