This is a migrated thread and some comments may be shown as answers.

Problem with Lambda expression

1 Answer 86 Views
Code Converter
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Aaron
Top achievements
Rank 1
Aaron asked on 25 Jan 2013, 03:22 PM
I wanted to make you aware of a couple of problems with the conversion of the following code to VB.net.  When converted, this is converting the Lambda expression into a do loop.  Also, the _ in the function declaration was giving me fits trying to figure out what that should be.  I did eventually determine that the _ simply refers to a variable that you don't care what the return value is, and was able to get this converted (finally) with a different code conversion project, but I wanted to make you aware of the issue so that you can have a chance to try to fix the issue.  I have also attached what I hope is the converted form of this function.  Just trying to learn what this project is doing, so I may not be totally correct :)
    
public void Install(IWindsorContainer container, IConfigurationStore store)
{
    container.Register(AllTypes
        .FromAssemblyContaining(typeof(SaveZombieIncidentTask))
        .BasedOn(typeof(IRequestHandler<,>))
        .Unless(t => t.IsGenericTypeDefinition)
        .WithService.Select((_, baseTypes) =>
        {
            return
                from t in baseTypes
                where t.IsGenericType
                let td = t.GetGenericTypeDefinition()
                where td == typeof(IRequestHandler<,>)
                select t;
        }).LifestyleTransient());
}
Public Sub Install(container As Castle.Windsor.IWindsorContainer, store As Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore) Implements Castle.MicroKernel.Registration.IWindsorInstaller.Install
    container.Register(AllTypes.FromAssemblyContaining(GetType(EmployeesTask)).BasedOn(GetType(IRequestHandler(Of ,))).Unless(Function(t) t.IsGenericTypeDefinition).WithService.Select(Function(MyType, baseTypes) _
        From t In baseTypes _
        Where t.IsGenericType _
        Let td = t.GetGenericTypeDefinition() _
        Where td Is GetType(IRequestHandler(Of ,)) _
        Select t).LifestyleTransient())
End Sub

1 Answer, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 30 Jan 2013, 09:34 AM
Hi Aaron,

The Telerik converter is not really developed any more. We believe that it it is sufficient stage to handle most of the conversions from and to VB.NET, unfortunately, there are a few places (namely lamba expressions) where it is failing. We are aware of these issues, however, for now we don't have plans to further develop the converter.

All the best,
Genady Sergeev
the Telerik team

Consider using RadControls for ASP.NET AJAX (built on top of the ASP.NET AJAX framework) as a replacement for the Telerik ASP.NET Classic controls, See the product support lifecycle here.

Tags
Code Converter
Asked by
Aaron
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Share this question
or