c# - 错误 : Expression does not produce a value

标签 c# vb.net

我试图将以下 C# 代码转换为 VB.NET,但在编译代码时出现“表达式不产生值”错误

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 代码

    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 代码的倒数第二行,而 C# 代码编译没有问题。

转换有什么问题?

谢谢


最佳答案

您需要创建一个Sub(x),而不是Function(x)

关于c# - 错误 : Expression does not produce a value,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8617657/

相关文章:

c# - ServiceStack - 有没有办法强制所有序列化日期使用特定的 DateTimeKind?

c# - 可选注入(inject)当前用户的最佳实践

c# - 如何指示方法不成功

c# - 验证 .NET 时间格式的正则表达式

c# - 外部注释以相反的顺序包含,.Net Visual Studio

c# - 如何在 Visual Studio 2010 中将自己的扩展添加到 html/aspx 代码编辑器的上下文菜单中?

c# - Visual Studio 2017 - 如何在 IDE 中配置命令终端?

c++ - VB.NET Single 不等于 C float

c# - .Net 中 finalize 的成本

vb.net - 简单的 TCPClient/Listener ("hello world") 示例