Tuesday, September 1, 2009

Differences

What is the difference between delegate and events?
√ Actually events use delegates in bottom. But they add an extra layer on the delegates, thus forming the publisher and subscriber model.
√ As delegates are function to pointers they can move across any clients. So any of the clients can add or remove events, which can be pretty confusing. But events give the extra protection by adding the layer and making it a publisher and subscriber model.
Just imagine one of your clients doing this c.XyzCallback = null This will reset all your delegates to nothing and you have to keep searching where the error is.


What are similarities between Class and structure ?
Following are the similarities between classes and structures :-
√ Both can have constructors, methods, properties, fields, constants, enumerations, events, and event handlers. √ Structures and classes can implement interface.
√ Both of them can have constructors with and without parameter.
√ Both can have delegates and events.

What is the difference between Class and structure’s ?
Following are the key differences between them :-
√ Structure are value types and classes are reference types. So structures use stack and classes use heap.
√ Structures members can not be declared as protected, but class members can be. You can not do inheritance in structures.
√ Structures do not require constructors while classes require.
√ Objects created from classes are terminated using Garbage collector. Structures are not destroyed using GC.


What is the difference between System.String and System.StringBuilder classes?
System.String is immutable;
System.StringBuilder can have mutable string where a variety of operations can be performed.


What is the difference between "Web.config" and "Machine.Config" ?

"Web.config" files apply settings to each web application, while "Machine.config" file apply settings to all ASP.NET applications.


What is the difference between Server.Transfer and response.Redirect ?
Following are the major differences between them:-
√ Response.Redirect sends message to the browser saying it to move to some different page, while server.transfer does not send any message to the browser but rather redirects the user directly from the server itself. So in server.transfer there is no round trip while response.redirect has a round trip and hence puts a load on server.
√ Using Server.Transfer you can not redirect to a different from the server itself. Example if your server is www.yahoo.com you can use server.transfer to move to www.microsoft.com but yes you can move to www.yahoo.com/travels, i.e. within websites. This cross server redirect is possible only using Response.redirect.
√ With server.transfer you can preserve your information. It has a parameter called as "preserveForm". So the existing query string etc. will be able in the calling page.


What is the difference between Authentication and authorization?
These two concepts seem altogether similar but there is wide range of difference. Authentication is verifying the identity of a user and authorization is process where we check does this identity have access rights to the system. In short we can say the following authentication is the process of obtaining some sort of credentials198 from the users and using those credentials to verify the user’s identity.
Authorization is the process of allowing an authenticated user access to resources. Authentication always proceed to Authorization; even if your application lets anonymous users connect and use the application, it still authenticates them as being anonymous.

No comments:

Post a Comment