且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从C#转换为VB.NET的代码中出现奇怪的错误

更新时间:2022-10-14 19:24:36

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)