Reputation: 1
I can achieve in VB what the following C# snippet does but it seems very clunky since I perform a Linq query to obtain the events for the relevant user. Is there a neat way?
ctx.FetchEventsForWhichCurrentUserIsRegistered((op) =>
{
if (!op.HasError)
{
var items = op.Value;
_currentUserRegisteredEventIds = new HashSet<int>(items);
UpdateRegistrationButtons();
}
}, null);
}
else
{
_currentUserRegisteredEventIds = null;
UpdateRegistrationButtons();
}
Upvotes: 0
Views: 142
Reputation: 1461
Reflector is always useful for this - compile your code, then disassemble and convert to your chosen language. I've not used this personally, but this add-in seems to even export the code into a project as well: http://filegenreflector.codeplex.com/
Upvotes: 0
Reputation: 24919
ctx.FetchEventsForWhichCurrentUserIsRegistered(Function(op) Do
If Not op.HasError Then
Dim items = op.Value
_currentUserRegisteredEventIds = New HashSet(Of Integer)(items)
UpdateRegistrationButtons()
End If
End Function, Nothing)
i found the following web app to be useful for this: http://www.developerfusion.com/tools/convert/vb-to-csharp/
although minor tweaking is sometimes required
Upvotes: 1