1. Code to Export DataGrid to Excel in web application
Response.AddHeader("Content-Disposition" "attachment;filename ReviewDesignation.xls");//This lets you always open the Excel window when exporting whether you click on open or save.
System.IO.StringWriter oStringWriter new
2. What debugging tools come with the .NET SDK?
A. CorDBG – command-line debugger. To use CorDbg, you must compile the original C# file using the /debug switch.
B. DbgCLR – graphic debugger. Visual Studio .NET uses the DbgCLR.
3. What does assert() method do?
In debug compilation, assert takes in a Boolean condition as a parameter, and shows the error dialog if the condition is false. The program proceeds without any interruption if the condition is true.
4. What’s the difference between the Debug class and Trace class?
Documentation looks the same. Use Debug class for debug builds, use Trace class for both debug and release builds.
5. What are the different ways a method can be overloaded?
Different parameter data types, different number of parameters, different order of parameters
6. Is XML case-sensitive?
7. What does the keyword “virtual” declare for a method or property?
The method or property can be overridden.
8. What is a satellite assembly?
When you write a multilingual or multi-cultural application in .NET, and want to distribute the core application separately from the localized modules, the localized assemblies that modify the core application are called satellite assemblies.
9. What is the smallest unit of execution in .NET?
10. How do you convert a value-type to a reference-type?
11. What does the term immutable mean?
Immutable means you can't change the currrent data, but if you perform some operation on that data, a new copy is created. The operation doesn't change the data itself. Like let's say you have a string object having "hello" value. Now if you say temp = temp + "new value" a new object is created, and values is saved in that. the temp object is immutable, and can't be changed.
12. Does Array.CopyTo make a deep copy?
13. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
ANS: Server.Trnasfer will prevent round trip. it will redirect pages which or in the same directory. NO way to pass the query strings . Thru http context we can able to get the previous page control values.
Response.Redirect : There is a round trip to process the request. We can redirect to any page external / internal other than aspx. We can pass the query string thru which we can manage sessions.
14. Explain the differences between Server-side and Client-side code?
ANS: Server side code will execute at server end all the business logic will execute at server end where as client side code will execute at client side at browser end.
15. How does VB.NET/C# achieve polymorphism?
ANS : Function overloading.