AGB
AGB

Reputation: 2448

VB.NET - Memory use of public shared method vs instance method

What is the difference in the way memory is allocated by my application between using a public shared method and a method of an instantiated class?

I have several classes of shared functions which query a database and return domain objects. Altogether these classes contains a lot of methods and I am interested as to whether it would be a better approach in terms of managing resources to use instance members instead.

Upvotes: 1

Views: 932

Answers (1)

Eric J.
Eric J.

Reputation: 150188

Code is not duplicated once per object instance, only object data is unique per object instance.

There will be no difference in memory usage for the method code between public shared or instance methods.

Upvotes: 1

Related Questions