Strange error in code converted to VB.NET from C# [duplicate]

本秂侑毒 提交于 2019-12-06 06:12:06

C# has a language feature, that can convert method groups to delegate type. So, instead of:

private void Foo() {}
private void Bar(Action arg) {}

Bar(new Action(Foo));

you can write:

Bar(Foo);

I'm not a VB guy, but I suspect, that VB .NET hasn't such feature. Looks like you need AddressOf operator:

New PropertyMetadata(False, AddressOf AutoScrollPropertyChanged)
Burak SARICA

I did not compile it, but I think you should refer AutoScrollPropertyChanged with the AddressOf operator:

Public Shared ReadOnly AutoScrollProperty As DependencyProperty =
        DependencyProperty.RegisterAttached("AutoScroll", GetType(Boolean),
        GetType(Helper),
        New PropertyMetadata(False, AddressOf AutoScrollPropertyChanged))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!