21. What is .Vshost ?
When we build our vs project this exe is created in the bin folder.it is a hosting process.and is used only by visual studio.it helps in imporving performance and supports immediate window.
22. What is managed and unmanaged code ?
Managed Code:the code which runs under CLR is called managed code eg-VB,C#.
Unmanaged Code:The code which is not compiled by CLR is called unmanaged code.eg-C++.
23. What is the significance of Finalize method in .NET?
.NET Garbage collector does almost all clean up activity for your objects. But unmanaged
resources (ex: - Windows API created objects, File, Database connection objects, COM objects
etc) is outside the scope of .NET framework we have to explicitly clean our resources. For these
types of objects, .NET framework provides Object. Finalize method, which can be overridden and
clean up code for unmanaged resources can be put in this section?
24. What is the use of DISPOSE method?
Dispose method belongs to ‘IDisposable’ interface. We had seen in the previous section how bad
it can be to override the finalize method for writing the cleaning of unmanaged resources. So if
any object wants to release its unmanaged code best is to implement I Disposable and override
the Dispose method of I Disposable interface. Now once your class has exposed the Dispose
method it is the responsibility of the client to call the Dispose method to do the cleanup.
25. What is .NET Remoting?
.NET remoting is replacement of DCOM. Using .NET remoting, you can make remote object
calls, which lie in different Application Domains. As the remote objects run in different process
client calling the remote object cannot call it directly. Therefore, the client uses a proxy, which
looks like a real object.
When client wants to make method call on the remote object it uses proxy for it. These method
calls are called as “Messages”. Messages are serialized using “formatter” class and sent to client
“channel”. Client Channel communicates with Server Channel. Server Channel uses as formatter
to deserialize the message and sends to the remote object.
26. Which is the best place to store connection string in .NET projects?
Config files are the best places to store connection strings. If it is a web-based application
“Web.config” file will be used and if it is a windows application “App.config” files will be used
27. How can we perform transactions in .NET?
The most common sequence of steps that would be performed while developing a transactional
application is as follows:
- Open a database connection using the Open method of the connection object.
- Begin a transaction using the Begin Transaction method of the connection object.
This method provides us with a transaction object that we will use later to commit
or rollback the transaction. Note that changes caused by any queries executed
before calling the Begin Transaction method will be committed to the database
immediately after they execute. Set the Transaction property of the command object
to the above mentioned transaction object.
- Execute the SQL commands using the command object. We may use
one or more command objects for this purpose, as long as the Transaction property of
all the objects is set to a valid transaction object.
- Commit or roll back the transaction using the Commit or Rollback method of the
- Close the database connection.
28. What is the difference between public, static and void?
All these are access modifiers in C#. Public declared variables or methods are accessible anywhere in the application. Static declared variables or methods are globally accessible without creating an instance of the class. The compiler stores the address of the method as the entry point and uses this information to begin execution before any objects are created. And Void is a type modifier that states that the method or variable does not return any value.
29. What is DLL Hell, and how does .NET solve it?
DLL Hell describes the difficulty in managing DLLs on a system; this includes multiple copies of a DLL, different versions, and so forth. When a DLL (or assembly) is loaded in .NET, it is loaded by name, version, and certificate. The assembly contains all of this information via its metadata. The GAC provides the solution, as you can have multiple versions of a DLL side-by-side.