With C# anonymous delegates, we can avoid declaration of extra method, I know in VB.NET they’re not available, but is there a design pattern that I can use so that I can avoid writing an extra method each time? I need it for SPSecurity.RunWithElevatedPrivileges which will be used a lot of times in our code.
for example
SPSecurity.RunWithElevatedPrivileges(
delegate()
{
//some code here.
}
);
I want in VB.NET to do something like:
using RunWithElevatedPrivil()
'some code here.
end using
Check this link, it may help:
http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/4854962a-0d4e-40e4-909a-581bb7a5ab03