what is the equivalent to this c#?

zapperX

New member
Joined
Jan 12, 2014
Messages
2
Programming Experience
10+
VB.NET:
    Private Sub SetupServiceLocator()

        Dim injector As IServiceLocator = _
            New WindsorServiceLocator( _
                New WindsorContainer( _
                    New XmlInterpreter( _
                        New ConfigResource("oauth.net.components"))))


         ServiceLocator.SetLocatorProvider(() => injector)'<=== HOW DO I WRITE THIS IN VB???


    End Sub
I understand it's a lambda expression and it creates a delegate(?) for the SetLocationProvider that will return injector, but it is obviously not vb compliant. Does anyone know what a vb equivalent would be?
thanks
 
ServiceLocator.SetLocatorProvider(Function() injector)
 
What's the point of the delegate in this particular case? Couldn't you just ServiceLocator.SetLocatorProvider(injector)?

I haven't checked but presumably the SetLocatorProvider method expects a delegate as an argument rather than an IServiceLocator reference.
 
Back
Top