Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 255
  • Last Modified:

Static methods

Hi

I have two methods in a static class as follows

static class GetSingleObject
{

  static void GetConnectionToOracle()
  {
 
   //ConnectionString to connect for oracle

  }

  static void GetConnectionToSqlserver()
  {
 
   //ConnectionString to connect for Sqlserver

  }

}


if  i say GetSingleObject.GetConnectionToOracle() , it will returns OracleConnection

and if say GetSingleObject.GetConnectionToSqlserver(), it will returns sqlconnection


I would like to know the following.


1) Is the single object of GetSingleObject Class will return two connection strings

      or it will internally creates two object for GetSingleObject Class.

2) Is every static method in the staic class going to contain its own memory

    or only the memory will be created to Static class ?


Please Clarify
0
praveen1981
Asked:
praveen1981
  • 2
  • 2
1 Solution
 
käµfm³d 👽Commented:
Please explain what you mean by "connection strings".
0
 
CodeCruiserCommented:
Your question indicates that you don't understand what static methods do. Class objects are not created for static methods. The difference between standard (instance) methods and static methods is that an instance of the class is created for instance methods whereas no instance is created for static methods.
0
 
praveen1981Author Commented:
Hi

I do agree and understand  you , but i want to know the following.


2) Is every static method in the staic class going to contain its own memory

    or only the memory will be created at Static class level ?
0
 
käµfm³d 👽Commented:
Maybe next time respond sooner than 11 days later? Just a thought  = )
0
 
praveen1981Author Commented:
I did not get any response for this , so i am closing this question
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now