performance question

S

Steven

Which one is faster and why:


dim x as new X
x.Y = 1
system.console.writeline(x.Y)

public class X

private prop_y as integer

public property Y() as integer
get
return prop_y
end get
set(byval value as integer)
prop_Y = value
end set
end property

end class




or this:

dim x as new X
x.setY(1)
system.console.writeline(x.getY)


public class X

private y as integer

public sub setY(byval v as integer)
y=v
end sub

public function getY() as integer
return y
end function

end class



Thanks,

Steven
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top