c# - Convert c# code with inline delegate to vb.net
问题描述
I need to convert this code to vb.net
public IDisposable WriteLock()
{
EnterWriteLock();
return new LockDisposer(delegate() { ExitWriteLock(); });
}
This is what I got with the online converters
Public Function WriteLock() As IDisposable
EnterWriteLock()
Return New LockDisposer(Sub() ExitWriteLock()) <-- Error Line
End Function
I am using .net 2.0
解决方案
Public Function WriteLock() As IDisposable
EnterWriteLock()
Return New LockDisposer(AddressOf ExitWriteLock)
End Function
推荐阅读
- node.js - 如何根据 Angular 中选择的数据类型创建视图?
- vue.js - 我需要在 nuxtjs 上使用 JSZip 为多个文件制作 zip
- regex - 在特殊字符之后返回短语的某些元素
- android - 在不同的 Android 版本上动态更改工具栏菜单项文本颜色
- javascript - 如何在 JavaScript 正则表达式中转义单个反斜杠?
- angular - docker run 后 Docker 自己被杀了
- authentication - Django rest框架注销和登录视图不起作用
- sql - best way to convert column to json array (Oracle)
- groovy - ProxyException:groovy.lang.MissingMethodException:没有方法签名:java.lang.Class.encode()
- permissions - 在 Centos 中允许非 root 用户使用 crontab