|
INTERVIEW QUESTIONS
MICROSOFT
.NET DATABASE
DETAILS
Question: How do you declare a static variable and what is its lifetime? Give an example.
Answer: First answer: static int Myint–The life time is during the entire application.
Second answer: The static modifier is used to declare a static member, which belongs to the type itself rather than to a specific object. The static modifier can be used with fields, methods, properties, operators, events and constructors, but cannot be used with indexers, destructors, or types. In C#, the static keyword indicates a class variable. In VB, the equivalent keyword is Shared. Its scoped to the class in which it occurs.
Example a. Static int var //in c#.net b. static void Time( ) //in c#.net
|
|
|
Category |
.Net Database Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 9113 users |
Added on |
9/13/2014 |
Views |
69433 |
Rate it! |
|
|
Question:
How do you declare a static variable and what is its lifetime? Give an example.
Answer:
First answer: static int Myint–The life time is during the entire application.
Second answer: The static modifier is used to declare a static member, which belongs to the type itself rather than to a specific object. The static modifier can be used with fields, methods, properties, operators, events and constructors, but cannot be used with indexers, destructors, or types. In C#, the static keyword indicates a class variable. In VB, the equivalent keyword is Shared. Its scoped to the class in which it occurs.
Example a. Static int var //in c#.net b. static void Time( ) //in c#.net
Source: CoolInterview.com
static int Myint?The life time is during the entire application. Source: CoolInterview.com
Answered by: sushil | Date: 4/28/2010
| Contact sushil
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
What are good ADO.NET object(s) to replace the ADO Recordset object?
|
View Answer
|
|
What is the .NET datatype that allows the retrieval of data by a unique key?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All .Net Database Interview Questions & Answers - Exam Mode /
Learning Mode
|