[英]Error after converting prioject to VB.NET (From C#)
I want to converter this C# to VB.NET 我想将此C#转换为VB.NET
internal static void CreateMap(AutoMapperService autoMapperService)
{
Player.CreateMap(autoMapperService);
RawStats.CreateMap(autoMapperService);
autoMapperService.CreateMap<string, GameTypeEnum>()
.ConvertUsing(s => GameTypeConsts.GameTypes
.First(x => x.Value == s).Key);
autoMapperService.CreateMap<string, GameModeEnum>()
.ConvertUsing(s => GameModeConsts.GameModes
.First(x => x.Value == s).Key);
autoMapperService.CreateMap<string, GameSubTypeEnum>()
.ConvertUsing(s => GameSubTypeConsts.GameSubTypes
.First(x => x.Value == s).Key);
CreateMap<Game>(autoMapperService);
CreateMap<IGame>(autoMapperService).As<Game>();
autoMapperService.CreateMap<RecentGamesDto, IEnumerable<IGame>>()
.ConvertUsing(x => x.Games.Select(autoMapperService.Map<GameDto, IGame>));
}
VB.NET: VB.NET:
Friend Shared Sub CreateMap(autoMapperService As AutoMapperService)
Player.CreateMap(autoMapperService)
RawStats.CreateMap(autoMapperService)
autoMapperService.CreateMap(Of String, GameTypeEnum).ConvertUsing(Function(s) GameTypeConsts.GameTypes.First(Function(x) x.Value = s).Key)
autoMapperService.CreateMap(Of String, GameModeEnum).ConvertUsing(Function(s) GameModeConsts.GameModes.First(Function(x) x.Value = s).Key)
autoMapperService.CreateMap(Of String, GameSubTypeEnum).ConvertUsing(Function(s) GameSubTypeConsts.GameSubTypes.First(Function(x) x.Value = s).Key)
CreateMap(Of Game)(autoMapperService)
CreateMap(Of IGame)(autoMapperService).[As](Of Game)()
autoMapperService.CreateMap(Of RecentGamesDto, IEnumerable(Of IGame))().ConvertUsing(Function(x) x.Games.Select(autoMapperService.Map(Of GameDto, IGame)))
End Sub
I and up getting an exception at the last VB.NET Codeline: 我和最后一个VB.NET Codeline都出现了异常:
Telling me that I am missing the item property
告诉我我缺少item属性
Thats the original project: https://github.com/XeeX/LeagueOfLegendsAPI This is the function where I am missing the item property: https://github.com/XeeX/LeagueOfLegendsAPI/blob/master/PortableLeagueApi.Core/Services/AutoMapperService.cs 那就是原始项目: https : //github.com/XeeX/LeagueOfLegendsAPI这是我缺少item属性的函数: https : //github.com/XeeX/LeagueOfLegendsAPI/blob/master/PortableLeagueApi.Core/Services/ AutoMapperService.cs
Can someone give me a hint what am I missing? 有人可以提示我我想念什么吗?
Regards 问候
I'm not 100% sure (my VB.NET skills are rusty), but I think the problem is how you're trying to pass the Map
method as a parameter to Select
method. 我不太确定(我的VB.NET技能是生锈的),但是我认为问题是您试图将
Map
方法作为参数传递给Select
方法。 Try using AddressOf
: 尝试使用
AddressOf
:
autoMapperService.CreateMap(Of RecentGamesDto, IEnumerable(Of IGame))().ConvertUsing(Function(x) x.Games.Select(AddressOf autoMapperService.Map(Of GameDto, IGame)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.