vb.net - Instantiated List as valid IList Argument -


this no means serious issue me have worked around it, more inquisitive difference , why 1 compiles , won't. take @ following examples:

this builds.

sub foo()     dim somel ilist(of integer) = new list(of integer)    bar(somel)  end sub  sub bar(byref argsomel ilist(of integer)) 'do stuff end sub 

notice bar's argument of ilist. , somel actual list(of int) following not compile:

sub foo()     dim somel new list(of integer)    bar(somel)  end sub  sub bar(byref argsomel ilist(of integer))    'do stuff end sub 

are not both (foo()) calling bar argument of list not ilist?

byref extends scope of called function include callee function's variable byref parameter -- ie allows changing variable of callee.

it entirely superfluous if vb allowed multiple return values.

dim local1 , local2 int (local1, local2) = bar(local2) 

this hints @ solution example - don't use byref , sub, use byval , function.

function bar(byval foo ilist(of integer)) ilist(of integer)    return foo end function 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -