1 Why C# class does not support multiple inheritance where interface support??? Pls somebody give me the specific reason.
2. In real scenario where to use abstract class and where to use interface????
3. Why asp.net web.config file is xml based file????
4. When to call dispose method, when to call finalize method and when to call destructor method ???
5. What is the prior condition to store custom value in viewstate????
6. In real scenario when to use static constructor??
Pls somebody give me the most appropriate answer..thanks in advance...
Amit ChoudharyPosted Feb 26, 2010, 7:48 AM
ans(1): Because it follow OOPS concepts.
ans(2): Depends upon situations. Interface are used where no we always want to override the functions and some time need to create a refrence.
User abstract if some time you need to define a function body inside the abstract class( Only possible in c#) you can, but abstract means no definition just like Human head placed on table without any body. and you can not create reference of abstract classes.
ans(3): Cause it holds lot of configuration information kinda Database of Configurations. and sectional areas defined for different type of Config settings.
ans(4): Dispose()==> destroy the object, send out of memory
Finalize()==> for garbage collection when needed.
Destructor()==> Do Something before object goes out of memory. for eg: Send a notification
ans(5):
Three possible reasons/conditions for using viewstate:
• You need to store mission-critical data that the user cannot be allowed to tamper with. (An ingenious user could modify the view state information in a postback request.) In this case, consider session state.
• You need to store information that will be used by multiple pages. In this case, consider session state, cookies, or the query string.
• You need to store an extremely large amount of information, and you don't want to slow down page transmission times. In this case, consider using a database, or possibly session state.
ans(6): A typical use of static constructors is when the class is using a log file and the constructor is used to write entries to this file.Please Don't forget to mark it as answer.