c# - Overloaded VB.NET extension method in class library -


It seems that there are problems with my written library of written extensions in VB.NET.

I2 overloaded extension methods crop ().

When I refer to Lib from the VB.NET project, I see them. If it refers to the C # project, then I can not see them.

What's going on?

It works like this:

  • In C # When you call a method with a outside or ref parameter, the compiler will call out or riff Keyword needs to be repeated. This is because it does not make any difference to the language whether the variable is already initialized or not.
  • In VB.NET, when you call a method with the ByRef parameter, the compiler lets you repeat the ByRef on the calling logic Not necessarily, this fixes it for you because the language does not make any difference whether the variable is already initialized or not.

Therefore, VB.NET can easily solve an extension method by using ByRef . , Because there is only one possible way in which it can be called. However, C # does not know what to do because by saying that there is no syntax for calling method using outside or riff .

All you can do is:

  • Write your extension methods again to use the ByVal parameter wherever possible.
  • If this is not possible, you get stuck with them in normal ways like calling C #.

Comments