Beruflich Dokumente
Kultur Dokumente
What is boxing?
Boxing is the process of converting a value type to the type object or to any interface type
implemented by this value type. When the CLR boxes a value type, it wraps the value inside a
System.Object and stores it on the managed heap. Unboxing extracts the value type from the object.
Boxing is implicit; unboxing is explicit.
int i = 123;
// The following line boxes i.
object o = i;
o = 123;
i = (int)o;
// unboxing
What is Reflection?
Reflection provides objects (of type Type) that describe assemblies, modules and types.
// UsingGetType to obtain type information:
int i = 42;
System.Type type = i.GetType();
System.Console.WriteLine(type);
// Using Reflection to get information from an Assembly:
System.Reflection.Assembly info = typeof(System.Int32).Assembly;
System.Console.WriteLine(info);
Early Binding
Early Binding describes that compiler knows about what kind of
object it is, what are all the methods and properties it contains.
As soon as you declared the object, .NET Intellisense will populate
its methods and properties on click of the dot button.
Late Binding
Late Binding describes that compiler does not know what kind of
object it is, what are all the methods and properties it contains.
You have to declare it as an object, later you need get the type of
the object, methods that are stored in it. Everything will be known
at the run time.
Difference
Application will run faster in Early binding, since no boxing or
unboxing are done here.
Easier to write the code in Early binding, since the
intellisense will be automatically populated
Minimal Errors in Early binding, since the syntax is checked
during the compile time itself.
Late binding would support in all kind of versions, since
everything is decided at the run time.
Minimal Impact of code in future enhancements, if Late Binding
is used.
Performance will be code in early binding.
What is an Interface and how is it different from a Class?
When would using Assembly.LoadFrom and Assembly.LoadFile?
What's the difference between viewstate and sessionstate?
How to redirect a page to another page?
How to pass values between pages? Query String, Context, Session
This
The
clients url history list or current url Server does not update in case of
Server.Transfer.
Response.Redirect is used to redirect the users browser to another page or
site.
All
objects stored in session are required to be serializable for Out-ofProcess state management.
What is caching?
Caching is a technique used to increase performance by keeping frequently
accessed data or files in memory. The request for a cached file/data will
be accessed from cache instead of actual location of that file.
What are the different types of caching?
ASP.NET has 3 kinds of caching :
1. Output Caching,
2. Fragment Caching,
3. Data Caching.
Is it possible to create web application with both webforms and mvc?
Yes. We have to include below mvc assembly references in the web forms
application to create hybrid application.
System.Web.Mvc
System.Web.Razor
System.ComponentModel.DataAnnotations
PreviousPage can be used to get the posted values on the page to which the
page has been posted.
What is MVC?
MVC is a framework used to create web applications. The web application
base builds on
application logic from UI, and the input and events from the user will be
controlled by the Controller
Differentiate strong typing and weak typing
In strong typing, the data types of variable are checked at compile time.
On the other hand, in case of weak typing the variable data types are
checked at runtime. In case of strong typing, there is no chance of
compilation error. Scripts use weak typing and hence issues arises at
runtime.
List the major built-in objects in ASP.NET?
Application
Request
Response
Server
Session
Context
Trace
Printed
C#
exception
handling
is
built
upon
four
try: A try block identifies a block of code for which particular exceptions
will be activated. It's followed by one or more catch blocks.
throw: A program throws an exception when a problem shows up. This is done
using a throw keyword.
Hidden Field
View State
Cookies
Control State
Query Strings
Server side
1.
2.
Session
Application
TEST_CUR SYS_REFCURSOR;
QUERY
VARCHAR2(200);
Cur_DATEDATE;
BEGIN
QUERY :='select sysdate as mydate from dual';
OPEN TEST_CUR FOR QUERY;
LOOP
FETCH TEST_CUR
INTOCur_DATE;
EXITWHEN TEST_CUR%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(Cur_DATE);
ENDLOOP;
CLOSE TEST_CUR;
ENDmyprocedure;
wat is view?
session.abandon()
parent class of the Web server control?
Printed
When you set the value of the AutoEventWireup attribute to true, the
ASP.NET runtime does not require events to specify event handlers
like the Page_Load event or the Page_Init event. This means that in
Visual C# .NET, you do not have to initialize and to create the
delegate structures.
Can we declare an Abstract method in non-abstract class?
No its not possible
In C# how do you find the last error which occurred ?
This can be done by implementing a method called GetLastError().
Generally this returns aASPError object stating the error condition
that has occurred. This method will work only before the .ASP page
sent any content to the Client.
Exception LastErrorOccured;
String ShowErrMessage;
LastErrorOccured = Server.GetLastError();
if (LastErrorOccured != null)
ShowErrMessage = LastErrorOccured.Message;
else
ShowErrMessage = "No Errors";
Response.Write("Last Error Occured = " + ShowErrMessage);
Which method do you use to redirect the user to another page without
performing a round trip to the client?
Server.Transfer and Server.Execute.
Printed