2011-12-23 20 views
4

我試圖轉換下面的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#代碼編譯沒有問題。

轉換出了什麼問題?

感謝


回答

5

你需要創建一個Sub(x),而不是一個Function(x)

+0

如果我更改爲Sub(x)New SchemaExport(x).Execute(False,True,False)'現在我得到了New的語法錯誤。 – hardywang 2011-12-23 15:26:51

+0

你需要升級到VB.Net 2010 – SLaks 2011-12-23 15:27:37

+0

它是在VB.NET 2010. – hardywang 2011-12-23 15:29:03

相關問題