26.02.2015 Views

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

DOT NET Interview Questions - DotNetSpider

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

√<br />

First create your class with static members.<br />

Public class ClsStaticClass<br />

End class<br />

Private shared objCustomer as clsCustomer<br />

This ensures that there is actually only one Customer object through out the project.<br />

√<br />

√<br />

Second define a private constructor to your class.<br />

Note: - defining a private constructor to class does not allow a client to create objects directly.<br />

Finally provide a static method to get access to your singleton object.<br />

(A)How do you implement prototype pattern in .<strong>NET</strong>?<br />

Twist: - How to implement cloning in .<strong>NET</strong> ? , What is shallow copy and deep copy ?<br />

Cloning is achieved by using ICloneable of the System namespace. It has a “Clone” method<br />

which actually returns the reference of the same copy. Clone method allows a Shallow<br />

copy and not a deep copy. In Shallow copy if you make changes to the cloned object it<br />

actually does change on the main object itself. So how is deep copy achieved, by using<br />

“ISerializable” interface? So what you do is first serialize the object then deserialize back<br />

to a complete new copy. Now any changes to this new copy do not reflect on the original<br />

copy of the object, this is called as Deep copy.<br />

(I)What are the situations you will use a Web Service and Remoting in<br />

projects?<br />

Well “Web services” uses “remoting” concepts internally. But the major difference between<br />

“web service” and “remoting” is that “web service” can be consumed by clients who are<br />

not .<strong>NET</strong> platform. While remoting you need the client to be .<strong>NET</strong> compliant. Regarding<br />

the speed issue “Remoting” is faster than “Web Services”. So I think when deciding the<br />

architecture side of choosing between “Web services” and “Remoting” keep the cross<br />

platform issue and the speed issue in mind.<br />

(A)Can you give a practical implementation of FAÇADE patterns?<br />

155

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!