Question 1. Describe The Advantages Of Writing A Managed Code Application Instead Of Unmanaged One. What’s Involved In Certain Piece Of Code Being Managed?
The benefits consist of automatic garbage collection, memory control, assist for versioning and security. These advantages are supplied thru .NET FCL and CLR, at the same time as with the unmanaged code comparable abilties needed to be implemented through 1/3-birthday celebration libraries or as a part of the utility itself.
Question 2. Are Com Objects Managed Or Unmanaged?
Since COM items had been written earlier than .NET, apparently they are unmanaged.
Any code now not written in the Microsoft .NET framework environment is UNMANAGED. So clearly COM+ is unmanaged because it's miles written in Visual Basic 6.
. NET Interview Questions
Question 3. So Can A Com Object Talk To A .Internet Object?
Yes, through Runtime Callable Wrapper (RCW) or PInvoke.
Question 4. How Do You Generate An Rcw From A Com Object?
Use the Type Library Import software shipped with SDK. Tlbimp COM item.Dll /out:.NETobject.Dll or reference the COM library from Visual Studio for your project.
MVC Framework Tutorial
Question 5. I Can’t Import The Com Object That I Have On My Machine. Did You Write That Object?
You can most effective import your personal objects. If you need to use a COM element from any other developer, you need to achieve a Primary Interop Assembly (PIA) from whoever authored the original item.
You *can* import COM objects, although they're not your personal. It is usually recommended that you purchased the Primary Interop from the seller, but now not required. The maximum not unusual trouble importing a COM DLL is that it exposes items that shape a part of a separate COM DLL. You can generate entropy for these extra DLLs, after which discuss with them whilst importing the hassle DLL.
MVC Framework Interview Questions
Question 6. How Do You Call Unmanaged Methods From Your .Net Code Through Pinvoke?
Supply a DllImport attribute. Declare the strategies for your .NET code as static extern. Do no longer put into effect the methods as they're applied to your unmanaged code, you’re just offering declarations for method signatures.
Question 7. Can You Retrieve Complex Data Types Like Structs From The Pinvoke Calls?
Yes, simply make sure you re-claim that struct, in order that managed code is aware of what to do with it.
Microsoft Entity Framework Tutorial Microsoft Entity Framework Interview Questions
Question 8. I Want To Expose My .Internet Objects To Com Objects. Is That Possible?
Yes, however few things must be taken into consideration first. Classes should put in force interfaces explicitly. Managed sorts should be public. Methods, homes, fields, and activities which can be uncovered to COM must be public. Types have to have a public default constructor with out a arguments to be activated from COM. Types can not be abstract.
Question 9. Can You Inherit A Com Class In A .Net Application?
The .NET Framework extends the COM model for reusability with the aid of including implementation inheritance. Managed sorts can derive directly or circuitously from a COM coclass; greater particularly, they can derive from the runtime callable wrapper generated with the aid of the runtime. The derived kind can reveal all the technique and homes of the COM object as well as strategies and residences implemented in controlled code. The ensuing object is in part carried out in managed code and partly applied in unmanaged code.
Framework7 Interview Questions
Question 10. Suppose I Call A Com Object From A .Internet Application, But Com Object Throws An Error. What Happens On The .Internet End?
COM strategies record mistakes through returning HRESULTs; .NET methods document them via throwing exceptions. The runtime handles the transition between the 2. Each exception class in the .NET Framework maps to an HRESULT.