无法将类型"void"隐式转换为"bool" [英] Cannot implicitly convert type 'void' to 'bool'

查看:634
本文介绍了无法将类型"void"隐式转换为"bool"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么这是一段代码:

    protected bool IsServerPeer(InitRequest initRequest)
    {
        return _subServerCollection.IsServerPeer(initRequest);
    }

创建错误:

不能将类型'void'隐式转换为'bool'

Cannot implicitly convert type 'void' to 'bool'

推荐答案

可能是因为_subServerCollection.IsServerPeer()具有返回类型void

Probably because _subServerCollection.IsServerPeer() has the return type void

这篇关于无法将类型"void"隐式转换为"bool"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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