VB.NET: Lambda expression, use assignment operator instead of equality

I have a method that accepts System.Action, here is what I'm trying to feed it:

Function() Me._existingImports = Me.GetImportedAds()

The fact is that he complains about the = sign, because he thinks I'm trying to make a comparison, but this is not so. I want to set Me._existingImports to Me.GetImportedAds (), but VB.NET complains that the DataTable does not have an a = operator.

How can I make it use an assignment operator instead of an equality operator?

In C #, this works fine:

() => this.existingImports = this.GetImportedAds()

Currently, the solution will be to use a standalone method, but thereby more code than necessary.

+3
source share
1 answer

Function() , , .

Function() (, x 42...) , ! ( , C- VB)

, Function(), <<25 > , (), .

Sub() Me._existingImports = Me.GetImportedAds()

# , ( ) ... => ... .

+8

Source: https://habr.com/ru/post/1771725/


All Articles