J
Joe Keller
Hello,
Could someone clarify for me the performance differences (if any) in using
static vs. non-static methods?
I have a custom SQL class that performs various functions within my
application (e.g. logs the user into the system, returns customer data,
etc.). Because I didn't want to have to pass a reference to this custom SQL
class between the various forms in my application OR instantiate a new
instance of the SQL class within each form, I defined all of the methods on
the SQL class as static. By defining the methods on the SQL class as
static, it has freed me from worrying about keeping an instance of the class
alive within my various forms and has resulted in some cleaner code.
However, is there a performance penalty for this type of implementation?
How does the class get instantiated and destroyed behind the scenes? Does
the custom SQL class get instantiated and destroyed after each method call
or does it live in memory until the application closes?
I wouldn't mind it living in memory until I close the application but I
wouldn't want the overhead of the class getting created and destroyed after
each method call.
Thanks in advance!
Joe
Could someone clarify for me the performance differences (if any) in using
static vs. non-static methods?
I have a custom SQL class that performs various functions within my
application (e.g. logs the user into the system, returns customer data,
etc.). Because I didn't want to have to pass a reference to this custom SQL
class between the various forms in my application OR instantiate a new
instance of the SQL class within each form, I defined all of the methods on
the SQL class as static. By defining the methods on the SQL class as
static, it has freed me from worrying about keeping an instance of the class
alive within my various forms and has resulted in some cleaner code.
However, is there a performance penalty for this type of implementation?
How does the class get instantiated and destroyed behind the scenes? Does
the custom SQL class get instantiated and destroyed after each method call
or does it live in memory until the application closes?
I wouldn't mind it living in memory until I close the application but I
wouldn't want the overhead of the class getting created and destroyed after
each method call.
Thanks in advance!
Joe