Click here to Skip to main content
15,909,445 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a scenario where i have to call same method with all same logic twice for two inpout parameters (1 and 0) individually one after another .

So is it better to write as

If ( x=1)
Call method()
elseif (x =0 )
Call Method()

or writing two separate methods will be provide better performance

public Function Method(1)

Public Function Method(2)
Posted

Simply stated, if your method does not need the input parameter then leave it as it stands. I see no performance gain in splitting it.
 
Share this answer
 
It's better to use the method that best suits your needs. since it does not modify the performance.
 
Share this answer
 
Methods are used for decreasing repetitive code. You used a Function instead of a Sub in my mind if your not returning anything use a Sub.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900