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

Top 5 Contributors of the Month
Steve Jackman
Imran Ghani
Santhakumar Munuswamy

Home >> Interview Question >> C# >> Post New Question Subscribe to Interview Questions

What is the use of static members in C#.NET?

Posted By :Srikanth     Posted Date :April 22, 2011    Points :40   Category :C# 
The static members are the members which are not associated with a particular occurrence of any class. To implement this you have to use the keyword "static" before any member function. They can't access to non-static members as they are not associated with object instances.

You can also find related Interview Question to What is the use of static members in C#.NET?  below: 

Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?

(Class constructor method is also known as type constructor or type initializer)
Instance constructor is executed when a new instance of type is created and the class constructor is executed after the type is loaded and before any one of the type members is accessed. (It will get executed only 1st time, when we call any static methods/fields in the same class.) Class constructors are used for static field initialization. Only one class constructor per type is permitted, and it cannot use the vararg (variable argument) calling convention. (More...)

Can you declare an override method to be static if the original method is not static?

No. The signature of the virtual method must remain the same.
(Note: Only the keyword virtual is changed to keyword override). (More...)

Is it possible to have a static indexer in C#?

No. Static indexers are not allowed in C#. (More...)

What is Static Constructor?

It is invoked when the instance of the class is created. (More...)

What is dynamic binding ? How is it different from static binding?

With dynamic binding, the decision on which object method to call is made at runtime.Dynamic binding is polymorphism. with static binding, the decision to on which method to call is made at compile time.c# uses static binding as the default method dispatching mechanism. (More...)

Static datamembers should be initialized inside the constructor. True or False.

False. Static datamembers should not be initialised inside constructor. (More...)

Why 'static' keyword is used before Main()?

Program execution starts from Main(). S it should be called before the creation of any object. By using static the Main() can now be called directly through the class name and there is no need to create the object to call it. So Main() is declared as static. (More...)

Consider the following code:

public class Example extends Thread
public void run()
System.out.println ("Hello");

public static void main (String args[])
new Example();

Select the correct option regarding the preceding code ?

1, The code will not compile.
2, The code will compile but will not execute.
3, The code will compile, execute, and display Hello as the output.
4, The code will compile, execute, but will not display anything.

Answer : 4 (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.

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