Doubt in the Operator Conversion

Asked

Viewed 43 times

0

I have a question about converting an operator into a c# struct for VB.

C#

  public static Angle operator +(Angle a)
        {
            return a;
        }

Vb

Public Shared Operator +(ByVal a As Angle)
        Return a
    End Operator

I would like to understand if this difference "public Static Angle Operator" to "Public Shared Operator" brings any difference, because Angle in VB "some", or Byval a as Angle already reduces this use?

  • This is VB.NET and not VB6

1 answer

0

I would like to understand if this difference "public Static Angle Operator" to "Public Shared Operator" brings any difference, because Angle in VB "some", or Byval a as Angle already reduces this use?

Say the as Angle already reduces this use. The name of this is inference. In VB it is not mandatory to inform the type of return unless you have set the parameter Strict On.

The code has the same effect as:

    Public Shared Operator +(ByVal a As Angle) As Angle
        Return a
    End Operator

Browser other questions tagged

You are not signed in. Login or sign up in order to post.