Does the OutAttribute attribute point to internal ByRef methods currently doing anything?

VB.NET does not have out parameters, but you can specify <Out()> ByRef for COM and P / Invoke methods to get the same effect for external methods.

Does this define the same thing in internal methods (i.e. methods called only by .NET code), does the Jitter compiler (or VB.NET) actually help? Or this is currently only useful as a programmer's note.

Is it possible that it can be used in the future Jitter, or is this attribute lost during compilation?

+9
out
Jul 19 '11 at 8:17
source share
2 answers

I confirmed that VB.NET <Out()> causes the C # client to require out arguments, so it really looks the same.

Also, the C # client passes its arguments with the current values ​​to the method, but this is not surprising, because, unlike in cases of COM or P / Invoke, sorting is not required. (And C # does not allow a property to be set using the out argument directly, so there seems to be no way to see if C # will optimize the previous unnecessary assignment.)

So, the answer seems to be whether future C # clients help use the code, and if the jitter ever sets up the C # equivalent, it will do the same here. Although, since languages ​​such as VB exist, this cannot do much, because they do not respect the out attribute.

+9
Jul 20 2018-11-11T00:
source share

I subclassed MembershipProvider VB, we will call it A, and then subclass A with C #, which we will call B. C #, B did not recognize the fact that abstract methods in MembershipProvider already implemented in VB, A until I applied OutAttribute in the VB class for parameters that were specified as out in the abstract methods of the base class MembershipProvider . This only affects COM or P / Invoke.

+1
Mar 10 '14 at 2:31
source share



All Articles