vb.net interface signature syntax -


this code below makes vs complain 2 things:

  1. icomparer interface must implement compare(...)

  2. implements... not valid within method/multiline lambda (inside function).

so what's wrong it? signature correct, making function lambda oneliner didn't help. it's same syntax in documentation anyway:

public class colorsorter : implements collections.icomparer     public function compare(x object, y object) integer         implements collections.icomparer.compare          dim cx drawing.color, cy drawing.color         dim hx single, hy single, sx single, sy single, bx single, single          cx = directcast(x, drawing.solidbrush).color         cy = directcast(y, drawing.solidbrush).color         sx = cx.getsaturation()         sy = cy.getsaturation()         hx = cx.gethue()         hy = cy.gethue()         bx = cx.getbrightness()         = cy.getbrightness()          if hx < hy : return -1         elseif hx > hy : return 1         else             if sx < sy : return -1             elseif sx > sy : return 1             else                 if bx < : return -1                 elseif bx > : return 1                 else : return 0                 end if             end if         end if     end function end class 

in vb there no statement terminator (like ; in c#), every line statement. that's why can't place new line in places in c#. , that's why code cannot compiled.

change method declaration 1 line:

public function compare(x object, y object) integer  implements collections.icomparer.compare 

or add _ @ end of first line tell compiler it's not end of statement , should merge next line before compilation:

public function compare(x object, y object) integer _   implements collections.icomparer.compare 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -