Win Surprise Gifts!!!
Top 5 Contributors of the Month
Post New Question
Subscribe to Interview Questions
What is Static Method?
Posted By :
Posted Date :
February 28, 2013
It is possible to declare a method as Static provided that they don't attempt to access any instance data or other instance methods.
You can also find related Interview Question to
What is Static Method?
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).
Can you declare the override method static while the original method is non-static?
No, you can't, the signature of the virtual method must remain the same, only the keyword virtual is changed to keyword override.
Is it possible to use base keyword from within the static method?
No, you will get error.
What is Method overloading?
Method overloading occurs when a class contains two methods with the same name, but different signatures.
What is Method Overriding? How to override a function in C#?
Use the override modifier to modify a method, a property, an indexer, or an event. An override method provides a new implementation of a member inherited from a base class. The method overridden by an override declaration is known as the overridden base method. The overridden base method must have the same signature as the override method.
You cannot override a non-virtual or static method. The overridden base method must be virtual, abstract, or override.
Can we call a base class method without creating instance?
Its possible If its a static method.
Its possible by inheriting from that class also.
Its possible from derived classes using base keyword.
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.
What is method to get XML and schema from Dataset?
getXML () and get Schema ()
The entry point to any of a .net project is a static void Main() because.....
The main has to be called when the class is loaded
What is Method used to bind the data into gridview ?
DataBind() Method used to bind the data into gridview
What method is used to place a value onto the top of a stack?
push() method, Push is the direction that data is being added to the stack. push() member method places a value onto the top of a stack.
What method removes the value from the top of a stack?
The pop() member method removes the value from the top of a stack, which is then returned by the pop() member method to the statement that calls the pop() member method.
How can you reference current thread of the method ?
"Thread.CurrentThread" refers to the current thread running in the method."CurrentThread" is a public static property.
How do I call a member method and pass a primitive type (Value Type) by reference?
Use the ref keyword when declaring the parameter of the method, for example:
public bool GetValue( ref int returnValue );
This will pass the numeric by reference.You can modify the value of returnValue within the body of GetValue and it will persist when the method call returns.
Quick Links For Interview Questions Categories:
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
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
Terms of Service
Tell A Friend