.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson

Home >> Forum >> .NET Framework >> Post New QuestionBookmark and Share Subscribe to Forum

What is use of static constructor in real time

Posted By: priya     Posted Date: November 23, 2009    Points:2   Category :.NET Framework
What is use of static constructor in real time scenario. Can any one explain me use of static constructor?


Author: nishithraj             
Posted Date: November 26, 2009     Points: 5   

Static constructor is used to initialize static data members as soon as the class is referenced first time. Through this we can restrict creating multiple objects for a class.

Singleton pattern is the best example for this. As you know each object occupies some space in memmory. But by this method we can reduce it. That means increase in perfomance.

Author: Abhisek Panda             
Posted Date: November 30, 2009     Points: 5   

The example yo can take is an banking application. The opening balance of every member is same. So it can be initialised inside static constructor.

Author: Sagar Pardeshi             
Posted Date: February 27, 2010     Points: 5   

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend