Tuesday, January 24, 2012
What is lazy loading?
The "Lazy Loading" design pattern actually equips the developer with the art of providing data only when a property is called for. In other words, it is a on-demand loading. It is an efficient technique to improve performance.
What is delay signing?
Delay signing allows you to place a shared assembly in the GAC by signing the assembly with just the public key.This allows the assembly to be signed with the private key at a later stage, when the development process is complete and the component or assembly is ready to be deployed. This process enables developers to work with shared assemblies as if they were strongly named, and it secures the private key of the signature from being accessed at different stages of development.
Monday, November 28, 2011
Difference between Association, Aggregation and Inheritance relationships.
An Association is a relationship between similar objects or objects with common structures.
Example:
An employee object is associated with manager object.
Aggregation is “a part of” relationship.
Example:
A student object is a part of College object.
Inheritance is a “is a “relationship where one or more classes are derived from a base class. The derived class has the base class plus its own characteristics.
Example:
French_Student class can be a derived class of student class.
Example:
An employee object is associated with manager object.
Aggregation is “a part of” relationship.
Example:
A student object is a part of College object.
Inheritance is a “is a “relationship where one or more classes are derived from a base class. The derived class has the base class plus its own characteristics.
Example:
French_Student class can be a derived class of student class.
Features of Static/Shared classes.
Static classes are used when any change made to an object should not affect the data and functions of the class. They can be used to create data and functions without the need of an instance.
Following are features of Static/Shared classes:-
-They can not be instantiated. By default a object is created on the first method call to that object.
-Static/Shared classes can not be inherited.
-Static/Shared classes can have only static members.
-Static/Shared classes can have only static constructor.
Following are features of Static/Shared classes:-
-They can not be instantiated. By default a object is created on the first method call to that object.
-Static/Shared classes can not be inherited.
-Static/Shared classes can have only static members.
-Static/Shared classes can have only static constructor.
Explain the concepts and capabilities of cross page posting
Cross Page Posting: It refers to the scenario where on event of some controls posts from one page to another instead of a normal postback. Normal postback is when for e.g. a button (or any control that postbacks) is clicked and web page is submits the page back to itself which means a return trip. In Cross page posting, on click of a button there would be no return trip.
Cross-page posting is done at the control level. It is possible to create a page that posts to different pages depending on what button the user clicks on. It is handled by done by changing the postbackurl property of the controls.
Cross-page posting is done at the control level. It is possible to create a page that posts to different pages depending on what button the user clicks on. It is handled by done by changing the postbackurl property of the controls.
What are Extender provider components? Explain how to use an extender provider in the project.
An extender provider is a component that provides properties to other components.
Implementing an extender provider:
•Use the ProvidePropertyAttribute, which specifies the name of the property that an implementer of IExtenderProvider provides to other components, attribute to specify the property provided by your extender provider.
•Implement the provided property.
•Track which controls receive your provided property.
•Implement the IExtenderProvider, which defines the interface for extending properties to other components in a containe, interface.
Implementing an extender provider:
•Use the ProvidePropertyAttribute, which specifies the name of the property that an implementer of IExtenderProvider provides to other components, attribute to specify the property provided by your extender provider.
•Implement the provided property.
•Track which controls receive your provided property.
•Implement the IExtenderProvider, which defines the interface for extending properties to other components in a containe, interface.
What is the GAC? What problem does it solve?
Global Assembly Cache (GAC):
Any system that has the CLR (common language runtime) installed, has a machine-wide code cache known as GAC.
Assemblies deployed in the global assembly cache need to have a strong name.
The Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK can be used to deploy assemblies to GAC.
Any system that has the CLR (common language runtime) installed, has a machine-wide code cache known as GAC.
Assemblies deployed in the global assembly cache need to have a strong name.
The Global Assembly Cache tool (Gacutil.exe), provided by the .NET Framework SDK can be used to deploy assemblies to GAC.
What are implementation inheritance and interface inheritance?
Implementation inheritance is achieved when a class is derived from another class in such a way that it inherits all its members.
Interface inheritance is when a class inherits only the signatures of the functions from another class.
Interface inheritance is when a class inherits only the signatures of the functions from another class.
What is the use of System.Environment class in C#.NET?
The System.Environment class can be used to retrieve information like:
command-line arguments
the exit code
environment variable settings
contents of the call stack
time since last system boot
the version of the common language runtime.
command-line arguments
the exit code
environment variable settings
contents of the call stack
time since last system boot
the version of the common language runtime.
What is the difference between const and readonly in C#.NET?
The read only can be modified by the class it is contained in. However, the const cannot be modified. It needs to be instantiated only at the compile time.
What is strong-typing versus weak-typing? Which is preferred? Why?
In weak typing, it is allowed to define a block of memory as another type (casting).
Languages like C, C++ are weakly and statically typed.
Languages like Perl and PHP are weakly typed as you can add numbers to strings and they will implicitly coerce it.
Languages like Java, C# and Python are strongly typed. In these the type conversion needs to be explicitly handled.
For scripts we use weak typing.
In big programs, we use strong typing which can reduce errors at compile time
Languages like C, C++ are weakly and statically typed.
Languages like Perl and PHP are weakly typed as you can add numbers to strings and they will implicitly coerce it.
Languages like Java, C# and Python are strongly typed. In these the type conversion needs to be explicitly handled.
For scripts we use weak typing.
In big programs, we use strong typing which can reduce errors at compile time
Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.
Interface oriented approach compels to develop the software based on the contract.
Object oriented approach emphasizes on its aspects like:
Abstraction
Encapsulation
Inheritance
Polymorphism
Cross cutting concerns cannot be implemented in object oriented programming.
That’s not the case with aspect-oriented. However, there is a risk of system failure in this situation.
Object oriented approach emphasizes on its aspects like:
Abstraction
Encapsulation
Inheritance
Polymorphism
Cross cutting concerns cannot be implemented in object oriented programming.
That’s not the case with aspect-oriented. However, there is a risk of system failure in this situation.
What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?
•XML Web services are more restricted than objects exposed over .NET Remoting.
•XML Web services support open standards that target cross-platform use.
•XML Web services are generally easier to create and due to the restricted nature of XML Web services, the design issues are simplified.
•XML Web services support only SOAP message formatting, which uses larger XML text messages.
•Communication with .NET Remoting can be faster than XML Web service communication with a binary formatter.
•XML Web services are designed for use between companies and organizations.
•XML Web services don't require a dedicated hosting program because they are always hosted by ASP.NET.
•Consumers can use XML Web services just as easily as they can download HTML pages from the Internet. Thus there's no need for an administrator to open additional ports on a firewall as they work through MS-IIS and ASP.NET
•XML Web services support open standards that target cross-platform use.
•XML Web services are generally easier to create and due to the restricted nature of XML Web services, the design issues are simplified.
•XML Web services support only SOAP message formatting, which uses larger XML text messages.
•Communication with .NET Remoting can be faster than XML Web service communication with a binary formatter.
•XML Web services are designed for use between companies and organizations.
•XML Web services don't require a dedicated hosting program because they are always hosted by ASP.NET.
•Consumers can use XML Web services just as easily as they can download HTML pages from the Internet. Thus there's no need for an administrator to open additional ports on a firewall as they work through MS-IIS and ASP.NET
How to add a ReadOnly property in C#.NET?
Properties can be made read-only by having only a get accessor in the implementation.
public class X
{
public X(int id)
{
x_id = id;
}
public int ID
{
get
{
return x_id;
}
}
}
public class X
{
public X(int id)
{
x_id = id;
}
public int ID
{
get
{
return x_id;
}
}
}
How to prevent a class from being inherited in C#.NET?
The sealed modifier is used to prevent derivation from a class. An error occurs if a sealed class is specified as the base class of another class. A sealed class cannot also be an abstract class.
Explain the use of virtual, sealed, override, and abstract.
The virtual keyword enables a class to be overridden. If it has to be prevented from being overridden, then the sealed keyword needs to be used. If the keyword virtual is not used, members of the class can even then be overridden. However, its usage is advised for making the code meaningful.
The override keyword is used to override the virtual method in the base class. Abstract keyword is used to modify a class, method or property declaration. You cannot instantiate an abstract class or make calls to an abstract method directly.
An abstract virtual method means that the definition of the method needs to be given in the derived class.
The override keyword is used to override the virtual method in the base class. Abstract keyword is used to modify a class, method or property declaration. You cannot instantiate an abstract class or make calls to an abstract method directly.
An abstract virtual method means that the definition of the method needs to be given in the derived class.
Explain the use of virtual, sealed, override, and abstract.
The virtual keyword enables a class to be overridden. If it has to be prevented from being overridden, then the sealed keyword needs to be used. If the keyword virtual is not used, members of the class can even then be overridden. However, its usage is advised for making the code meaningful.
The override keyword is used to override the virtual method in the base class. Abstract keyword is used to modify a class, method or property declaration. You cannot instantiate an abstract class or make calls to an abstract method directly.
An abstract virtual method means that the definition of the method needs to be given in the derived class.
The override keyword is used to override the virtual method in the base class. Abstract keyword is used to modify a class, method or property declaration. You cannot instantiate an abstract class or make calls to an abstract method directly.
An abstract virtual method means that the definition of the method needs to be given in the derived class.
How does the XmlSerializer work? What ACL permissions does a process using it require?
The XmlSerializer constructor generates a pair of classes derived from XmlSerializationReader and XmlSerializationWriter by analysis of the classes using reflection.
Temporary C# files are created and compiled into a temporary assembly and then loaded into a process.
The XmlSerializer caches the temporary assemblies on a per-type basis as the code generated like this is expensive. This cached assembly is used after a class is created
Therefore the XmlSerialize requires full permissions on the temporary directory which is a user profile temp directory for windows applications
Temporary C# files are created and compiled into a temporary assembly and then loaded into a process.
The XmlSerializer caches the temporary assemblies on a per-type basis as the code generated like this is expensive. This cached assembly is used after a class is created
Therefore the XmlSerialize requires full permissions on the temporary directory which is a user profile temp directory for windows applications
Explain the difference between Server.Transfer and response.Redirect.
Redirect and Transfer both cause a new page to be processed. The difference lies in the way the interaction between the client and the server occurs.
Response.Redirect messages the client browser asking it to request for another page.
e.g. if a browser is on page A which has a Response.Redirect, then it asked to request for another page B by the server. When the client browser requests for it, then it is provided with the requested page B.
With Server.Transfer, the browser is not requested to ask for another page. Instead it is directly provided with the page B. In this scenario, the browser address bar continues to show the address of the previous URL.
Response.Redirect messages the client browser asking it to request for another page.
e.g. if a browser is on page A which has a Response.Redirect, then it asked to request for another page B by the server. When the client browser requests for it, then it is provided with the requested page B.
With Server.Transfer, the browser is not requested to ask for another page. Instead it is directly provided with the page B. In this scenario, the browser address bar continues to show the address of the previous URL.
Navigation methods in ASP.NET
Hyperlink control
Response.Redirect method
Server.Transfer method
Server.Execute method
Window.Open method
Hyperlink control
This is server control use for navigation to another page specified in the NavigateURL property. Hyperlink control doesn’t expose any server side event.
Response.Redirect method
This method is used to navigate to another page from code. You can use this method to navigate from a Linkbutton or ImageButton control.
For example
Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
Response.Redirect("Page2.aspx")
End Sub
Server.Transfer method
This method can be used only with .aspx file. It allows to retain some information between the requests when its preserveForm argument is set to true.
Server.Execute method
Like Server.Transfer, this method is also used with .aspx file only. This method enables new page execution while still displaying the current web form.
Window.Open method
Display a page in a new browser window on the client.
Response.Redirect method
Server.Transfer method
Server.Execute method
Window.Open method
Hyperlink control
This is server control use for navigation to another page specified in the NavigateURL property. Hyperlink control doesn’t expose any server side event.
Response.Redirect method
This method is used to navigate to another page from code. You can use this method to navigate from a Linkbutton or ImageButton control.
For example
Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
Response.Redirect("Page2.aspx")
End Sub
Server.Transfer method
This method can be used only with .aspx file. It allows to retain some information between the requests when its preserveForm argument is set to true.
Server.Execute method
Like Server.Transfer, this method is also used with .aspx file only. This method enables new page execution while still displaying the current web form.
Window.Open method
Display a page in a new browser window on the client.
Subscribe to:
Posts (Atom)