错误:表达式不产生值 [英] Error: Expression does not produce a value

查看:1024
本文介绍了错误:表达式不产生值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着转换下面的C#代码到VB.NET,得到了在编译代码表达式不会产生一个值错误

I tried to convert following C# code into VB.NET and got "Expression does not produce a value" error while compiling the code

C#代码

        return Fluently.Configure().Mappings(m => m.FluentMappings.AddFromAssemblyOf<MyEntityMapping>())
            .Database(SQLiteConfiguration.Standard.InMemory().ShowSql())
            .ExposeConfiguration(x => new SchemaExport(x).Execute(false, true, false))
            .BuildSessionFactory();



VB.NET代码

VB.NET Code

    Return Fluently.Configure() _
        .Mappings(Function(m) m.FluentMappings.AddFromAssemblyOf(Of SubscriptionMap)()) _
        .Database(SQLiteConfiguration.Standard.InMemory().ShowSql()) _
        .ExposeConfiguration(Function(x) New SchemaExport(x).Execute(False, True, False)) _
        .BuildSessionFactory()

上发生的VB.NET代码2日最后一行的错误,而C#代码是没有问题编译。

The error happens on 2nd last line of VB.NET code, while C# code is compiled without problem.

什么是错的转换?

感谢

推荐答案

您需要创建一个子(X),而不是功能( X)

You need to create a Sub(x), not a Function(x).

这篇关于错误:表达式不产生值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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