Thursday, January 24, 2008

Introducing C# 2.0

With the release of Visual Studio 2005 (formerly codenamed Whidbey), C# is back with some new innovations. The C# language has been updated to version 2.0 and comes with several language extensions which we will explore in this 2 part series article. Besides Generic types, the C# language introduces some other interesting features such as Iterators, Partial Classes and Anonymous methods, which are briefly mentioned below.

Generics
Although new to the .NET platform, this concept has been around for years. Generics is a term used to describe generic types. It greatly enhances application performance and type safety and allows you to write highly general, flexible and safe code. It permits classes, interfaces, structs, delegates and methods to be parameterized by the types of data they store and manipulate.
Iterators
Iterators specify how a for-each loop will iterate over a collection and return its internal items. They allow you to create enumerable classes with minimum coding.
Partial Classes
Partial Classes allows you to split a single type, like your class, across more than one file (.cs). They are useful if you have extremely large, unwieldy types.
Nullable Types
Nullable types allow a variable to contain a value that is undefined. This is useful when working with databases where the value returned might be null
Anonymous Methods
Anonymous Methods Are Inline Delegates. It enables you to pass a block of code as a parameter. Anonymous methods enables you to directly associate a block of code statements to a given event. You use them anywhere a delegate is used . So there is no need to define a new method.
Namespace alias qualifier
C# 2.0 adds the namespace alias qualifier, the :: operator, to provide more control over accessing namespace members.
Static Classes
With C# 2.0, now you also can declare classes as static. This signals the compiler that this class should not be instantiated and can only contains static members.
Property Accessor Accessibility
C# 2.0 allows a fine control over the accessibility of accessors and indexers within a property.
Covariance and Contravariance in Delegates
The method passed to a delegate may now have greater flexibility in its return type and parameters.

Generics
Classes are templates that you can use to build new objects. Generics are templates that you can use to build new classes. This code template can be applied to use the same code repeatedly. A generic class is tied to one or more specific data types.
Generics permit classes, interfaces, structs, delegates and methods to be parameterized by the types of data they store and manipulate. They are Type-independent algorithms and collections. They enable programmers to achieve a high level of code reuse and enhanced performance for collection classes. Generics are defined with left and right brackets: . Here ‘T’ in is the name of the type that is going to be used.
Let's demonstrate the use of Generics by taking a simple example:
namespace GenericsDemo
{
class TestGenerics
{
static void Main(string[] args)
{
GenericsExample();
}
private void GenericsExample()
{
ClsGeneric intGeneric = new ClsGeneric(1000);
ClsGeneric strGeneric = new ClsGeneric("Voila");
ClsGeneric fGeneric = new ClsGeneric(23.38f);
ClsGeneric dGeneric = new ClsGeneric(444.4);
ClsGeneric bGeneric = new ClsGeneric(true);
}
}
public class ClsGeneric
{
public ClsGeneric(T Type)
{
Console.WriteLine("T over here is {0} ", typeof(T).ToString());
}
}
}
By using a generic type parameter T, you can write a single class that other client code can use without incurring the cost or risk of runtime casts or boxing operations.
Iterators
In the earlier versions of C#, in order to use the for-each loop, you need to implement the IEnumerable interface which in turn demands the implementation of the GetEnumerator() method. This method returns an IEnumerator object using which you can use the foreach loop.
An iterator on the other hand, enables you to support foreach iteration in a class or struct without having to implement the entire IEnumerable interface.
Let me demonstrate this with an example :
public class StringCollection : System.Collections.IEnumerable
{
string[] names = { "Tom", "Dick", "Harry”, "Ralph", "Jack", "Jill” };
public System.Collections.IEnumerator GetEnumerator()
{
for (int i = 0; i <>
{
yield return names[i];
// In C#1.x you would have specified it using
// return names[i].GetEnumerator();
}
}
}
class TestStringCollection
{
static void Main()
{
// Create an instance
StringCollection strNames = new StringCollection();
foreach (string name in strNames)
{
System.Console.WriteLine(name);
}
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
}
}

Partial Classes
C# 2.0 introduces the concept of partial type definitions for classes, structs, and interfaces that allows you to define a C# type across multiple *.cs files. This leads to easier maintenance and development as more than one developer can simultaneously write the code for the class.
public partial class A
{
public void methodA()
{
// Code for methodA
}
}
public partial class A
{
public void methodB()
{
// Code for methodB
}
}
Nullable Types
A type is said to be nullable if it can be assigned a value or can be assigned a null reference. This change makes it easier to integrate with databases, especially for fields that are optional.
A null type is very similar to its equivalent non-nullable type. The difference lies in how it is declared. For example : To declare an integer, you would declare it like this :
int iVal = 1; 
However in order to enable iVal to store a null value, you will declare it like this :
int? iVal = 1;
Now the way to define any valuetype as a nullable type is to define the generic System.Nullable type. So the syntax to define a nullable integer is:
System.Nullable iVal;
However this is somewhat difficult to read and that is why C# provides a cleaner syntax for the nullable type by adding a question mark to the immediate right of the type name when defining a variable. The Syntax is [Value-Type]? 

So
System.Nullable iVal and int? iVal are equivalent.
Similarly you can also assign it a value null and use the HasValue and Value read-only properties to test for null and retrieve the value. Here’s an example :
int? iVal = null;
if (iVal.HasValue == true)
{
System.Console.WriteLine("iVal = " + iVal.Value);
}
else
{
System.Console.WriteLine("iVal = Null");
}
Anonymous Methods
Anonymous methods help you reduce the coding overhead in instantiating delegates, by eliminating the need to create a separate method. This construct allows you to directly associate a block of code statements to a given event. In general, you can use anonymous methods anywhere you can use a delegate. An anonymous method consists of the keyword delegate, an optional parameter list, and a statement list enclosed in { and } delimiters. In some cases, the anonymous methods can omit the parameter list.
public class frmOld : Form
{
// This method connects the event handler.
public frmOld()
{
InitializeComponent();
btnOld.Click += new EventHandler(ButtonClick);
}
// This is the event handling method.
private void ButtonClick(object sender, EventArgs e)
{
MessageBox.Show("Old method of handling ButtonClick");
}
}
Using Anonymous methods :
public class frmNew : Form
{
public frmNew()
{
InitializeComponent();
btnNew.Click += delegate(object sender, EventArgs e)
{
MessageBox.Show(“New way of handling button click using anonymous methods");
};
}
}
// Declare a delegate
delegate void PrintHello(string str);
class TestAnonymous
{
static void Main()
{
hello = new PrintHello(TestAnonymous.TestMethod);
Without anonymous method you would associate the delegate with a named method. For eg:
hello = new PrintHello(TestAnonymous.TestMethod);
//and declared a method to associate it with the named delegate
static void TestMethod(string test)
{
System.Console.WriteLine(test);
}
Static Classes
Static classes are classes that contain only static members. These static members can be initialized only by using static constructors. The data and functions that these classes create, can be accessed without creating an instance of the class. Static classes are sealed so they can not be inherited. TheSystem.Math class is an example of this construct.
Static classes can be used when there is no data or behavior in the class that depends on object identity. One of the advantages of static classes is improved performance. Since there is no instantiation of object, the framework maintains a single object in memory for static members. They are loaded automatically by the .NET Framework common language runtime (CLR) when the program or namespace containing the class is loaded.
Creating a static class is much the same as creating a class that contains only static members and a private constructor. A private constructor prevents the class from being instantiated. Lets see an example of a static class.
Property Accessor Accessibility
Properties provide flexibility to read and write the values of private fields. They can be used as though they are public data members, but they are actually special methods called accessors. This enables data to be accessed easily while still providing the safety and flexibility of methods.
In C# 1.x, we declare a property in our class in the following manner:
class ClsProp
{
private string strMyName = "Suprotim";
public string StrMyName
{
get { return strMyName; }
set { strMyName = value; }
}
}
Here the ‘get’ and the ‘set’ accessors have the same accessibility level i.e., they are both ‘public’ as the property itself is ‘public’. However, it is sometimes useful to restrict access to one of these accessors, which was not possible for us in C# 1.x.
In C# 2.0, this has changed :
public string StrMyName
{
get
{
return strMyName;
}
protected set
{
strMyName = value;
}
}
In this example, a property called StrMyName defines a get and set accessor. The get accessor receives the accessibility level of the property itself, public in this case, while the set accessor is explicitly restricted by applying the protected access modifier to the accessor itself.
Note : This feature of having Accessor Accessibility was provided in C# v1.0 beta. However Microsoft removed it before the C# v1.0 RTM as they felt it was too complicated for developers. In C# 2.0, it has been re-introduced.
Covariance and Contravariance

In .NET 1.1, delegates could only be created with methods whose arguments strictly matched the signature of that delegate. With .NET 2.0, Covariance and contravariance provide a degree of flexibility when matching delegate methods with delegate signatures.

What is new in ASP.NET 3.5

Microsoft released ASP.NET 3.5 on November 19, 2007. Along with it, was released Visual Studio 2008. This evolution from ASP.NET 2.0 to ASP.NET 3.5 is quiet gradual. ASP.NET 3.5 uses the same engine as that of ASP.NET 2.0, with some extra features added on top of it. In this article, we will explore the new features added to ASP.NET 3.5. This article assumes that you have been working on ASP.NET 2.0.

New Features in ASP.NET 3.5
ASP.NET AJAX
In ASP.NET 2.0, ASP.NET AJAX was used as an extension to it. You had to download the extensions and install it. However in ASP.NET 3.5, ASP.NET AJAX is integrated into the .NET Framework, thereby making the process of building cool user interfaces easier and intuitive.
The integration between webparts and the update panel is much smoother. Another noticeable feature is that you can now add ASP.NET AJAX Control Extenders to the toolbox in VS2008. Even though this is an IDE specific feature, however I feel it deserves a mention over here for developers, who had to add extenders using source view earlier. It is also worth noting that Windows Communication Foundation (WCF) now supports JSON along with other standard protocols like SOAP, RSS and POX.
New Controls
The ListView and DataPager are new controls added along with a new datasource control called the LinqDataSource.
ListView
The ListView control is quiet flexible and contains features of the Gridview, Datagrid, Repeater and similar list controls available in ASP.NET 2.0. It provides the ability to insert, delete, page (using Data Pager), sort and edit data. However one feature of the ListView control that stands apart, is that it gives you a great amount of flexibility over the markup generated. So you have a complete control on how the data is to be displayed. You can now render your data without using the tag. You also get a rich set of templates with the ListView control.
DataPager
DataPager provides paging support to the ListView control. The best advantage is that you need not have to keep it ‘tied’ with the control on which the paging is being done. You can keep it anywhere on the page.
DataPager gives you a consistent way of paging with the controls that support it. Currently only ListView supports it as it implements the IPageableItemContainer. However support is likely to be added to other List controls as well.
LINQ
LINQ (Language Integrated Query) adds native data querying capability to C# and VB.NET along with the compiler and Intellisense support. LINQ is a component of .NET 3.5. LINQ defines operators that allow you to code your query in a consistent manner over databases, objects and XML. The ASP.NET LinqDataSource control allows you to use LINQ to filter, order and group data before binding to the List controls.
You can learn more about LINQ over here.
ASP.NET Merge Tool
ASP.NET 3.5 includes a new merge tool (aspnet_merge.exe). This tool lets you combine and manage assemblies created by aspnet_compiler.exe. This tool was available earlier as an add-on.
New Assemblies
The new assemblies that would be of use to ASP.NET 3.5 developers are as follows:
· System.Core.dll - Includes the implementation for LINQ to Objects
· System.Data.Linq.dll - Includes the implementation for LINQ to SQL
· System.Xml.Linq.dll - Includes the implementation for LINQ to XML
· System.Data.DataSetExtensions.dll - Includes the implementation for LINQ to DataSet
· System.Web.Extensions.dll: Includes the implementation for ASP.NET AJAX (new enhancements added) and new web controls as explained earlier.
Some Other Important Points
1. ASP.NET 3.5 provides better support to IIS7. IIS7 and ASP.NET 3.5 modules and handlers support unified configuration.
2. You can have multiple versions of ASP.NET on the same machine.
3. For those who are wondering what happened to ASP.NET 3.0, well there isn’t anything called ASP.NET 3.0.
4. VS 2002 worked with ASP.NET 1.0, VS 2003 worked with ASP.NET 1.1, and VS 2005 worked with ASP.NET 2.0. However VS 2008 supports multi-targeting, i.e it works with ASP.NET 2.0, and ASP.NET 3.5.

Toughest HR Interview Questions

1. Tell me about yourself.

Since this is often the opening question in an interview, be extra careful that you don’t run off at the mouth. Keep your answer to a minute or two at most. Cover four topics: early years, education, work history, and recent career experience. Emphasize this last subject. Remember that this is likely to be a warm-up question. Don’t waste your best points on it.

2. What do you know about our organization?

You should be able to discuss products or services, revenues, reputation, image, goals, problems, management style, people, history and philosophy. But don’t act as if you know everything about the place. Let your answer show that you have taken the time to do some research, but don’t overwhelm the interviewer, and make it clear that you wish to learn more.

You might start your answer in this manner: “In my job search, I’ve investigated a number of companies.

Yours is one of the few that interests me, for these reasons…”

Give your answer a positive tone. Don’t say, “Well, everyone tells me that you’re in all sorts of trouble, and that’s why I’m here”, even if that is why you’re there.

3. Why do you want to work for us?

The deadliest answer you can give is “Because I like people.” What else would you like-animals?

Here, and throughout the interview, a good answer comes from having done your homework so that you can speak in terms of the company’s needs. You might say that your research has shown that the company is doing things you would like to be involved with, and that it’s doing them in ways that greatly interest you. For example, if the organization is known for strong management, your answer should mention that fact and show that you would like to be a part of that team. If the company places a great deal of emphasis on research and development, emphasize the fact that you want to create new things and that you know this is a place in which such activity is encouraged. If the organization stresses financial controls, your answer should mention a reverence for numbers.

If you feel that you have to concoct an answer to this question - if, for example, the company stresses research, and you feel that you should mention it even though it really doesn’t interest you- then you probably should not be taking that interview, because you probably shouldn’t be considering a job with that organization.

Your homework should include learning enough about the company to avoid approaching places where you wouldn’t be able -or wouldn’t want- to function. Since most of us are poor liars, it’s difficult to con anyone in an interview. But even if you should succeed at it, your prize is a job you don’t really want.

4. What can you do for us that someone else can’t?

Here you have every right, and perhaps an obligation, to toot your own horn and be a bit egotistical. Talk about your record of getting things done, and mention specifics from your resume or list of career accomplishments. Say that your skills and interests, combined with this history of getting results, make you valuable. Mention your ability to set priorities, identify problems, and use your experience and energy to solve them.

5. What do you find most attractive about this position? What seems least attractive about it?

List three or four attractive factors of the job, and mention a single, minor, unattractive item.

6. Why should we hire you?

Create your answer by thinking in terms of your ability, your experience, and your energy. (See question 4.)

7. What do you look for in a job?

Keep your answer oriented to opportunities at this organization. Talk about your desire to perform and be recognized for your contributions. Make your answer oriented toward opportunity rather than personal security.

8. Please give me your definition of [the position for which you are being interviewed].

Keep your answer brief and task oriented. Think in in terms of responsibilities and accountability. Make sure that you really do understand what the position involves before you attempt an answer. If you are not certain. ask the interviewer; he or she may answer the question for you.

9. How long would it take you to make a meaningful contribution to our firm?

Be realistic. Say that, while you would expect to meet pressing demands and pull your own weight from the first day, it might take six months to a year before you could expect to know the organization and its needs well enough to make a major contribution.

10. How long would you stay with us?

Say that you are interested in a career with the organization, but admit that you would have to continue to feel challenged to remain with any organization. Think in terms of, “As long as we both feel achievement-oriented.”

11. Your resume suggests that you may be over-qualified or too experienced for this position. What’s Your opinion?

Emphasize your interest in establishing a long-term association with the organization, and say that you assume that if you perform well in his job, new opportunities will open up for you. Mention that a strong company needs a strong staff. Observe that experienced executives are always at a premium. Suggest that since you are so wellqualified, the employer will get a fast return on his investment. Say that a growing, energetic company can never have too much talent.

12. What is your management style?

You should know enough about the company’s style to know that your management style will complement it. Possible styles include: task oriented (I’ll enjoy problem-solving identifying what’s wrong, choosing a solution and implementing it”), results-oriented (”Every management decision I make is determined by how it will affect the bottom line”), or even paternalistic (”I’m committed to taking care of my subordinates and pointing them in the right direction”).

A participative style is currently quite popular: an open-door method of managing in which you get things done by motivating people and delegating responsibility.

As you consider this question, think about whether your style will let you work hatppily and effectively within the organization.

13. Are you a good manager? Can you give me some examples? Do you feel that you have top managerial potential?

Keep your answer achievement and ask-oriented. Rely on examples from your career to buttress your argument. Stress your experience and your energy.

14. What do you look for when You hire people?

Think in terms of skills. initiative, and the adaptability to be able to work comfortably and effectively with others. Mention that you like to hire people who appear capable of moving up in the organization.

15. Have you ever had to fire people? What were the reasons, and how did you handle the situation?

Admit that the situation was not easy, but say that it worked out well, both for the company and, you think, for the individual. Show that, like anyone else, you don’t enjoy unpleasant tasks but that you can resolve them efficiently and -in the case of firing someone- humanely.

16. What do you think is the most difficult thing about being a manager or executive?

Mention planning, execution, and cost-control. The most difficult task is to motivate and manage employees to get something planned and completed on time and within the budget.

17. What important trends do you see in our industry?

Be prepared with two or three trends that illustrate how well you understand your industry. You might consider technological challenges or opportunities, economic conditions, or even regulatory demands as you collect your thoughts about the direction in which your business is heading.

18. Why are you leaving (did you leave) your present (last) job?

Be brief, to the point, and as honest as you can without hurting yourself. Refer back to the planning phase of your job search. where you considered this topic as you set your reference statements. If you were laid off in an across-the-board cutback, say so; otherwise, indicate that the move was your decision, the result of your action. Do not mention personality conflicts.

The interviewer may spend some time probing you on this issue, particularly if it is clear that you were terminated. The “We agreed to disagree” approach may be useful. Remember hat your references are likely to be checked, so don’t concoct a story for an interview.

19. How do you feel about leaving all your benefits to find a new job?

Mention that you are concerned, naturally, but not panicked. You are willing to accept some risk to find the right job for yourself. Don’t suggest that security might interest you more than getting the job done successfully.

20. In your current (last) position, what features do (did) you like the most? The least?

Be careful and be positive. Describe more features that you liked than disliked. Don’t cite personality problems. If you make your last job sound terrible, an interviewer may wonder why you remained there until now.

21. What do you think of your boss?

Be as positive as you can. A potential boss is likely to wonder if you might talk about him in similar terms at some point in the future.

22. Why aren’t you earning more at your age?

Say that this is one reason that you are conducting this job search. Don’t be defensive.

23. What do you feel this position should pay?

Salary is a delicate topic. We suggest that you defer tying yourself to a precise figure for as long as you can do so politely. You might say, “I understand that the range for this job is between $______ and $______. That seems appropriate for the job as I understand it.” You might answer the question with a question: “Perhaps you can help me on this one. Can you tell me if there is a range for similar jobs in the organization?”

If you are asked the question during an initial screening interview, you might say that you feel you need to know more about the position’s responsibilities before you could give a meaningful answer to that question. Here, too, either by asking the interviewer or search executive (if one is involved), or in research done as part of your homework, you can try to find out whether there is a salary grade attached to the job. If there is, and if you can live with it, say that the range seems right to you.

If the interviewer continues to probe, you might say, “You know that I’m making $______ now. Like everyone else, I’d like to improve on that figure, but my major interest is with the job itself.” Remember that the act of taking a new job does not, in and of itself, make you worth more money.

If a search firm is involved, your contact there may be able to help with the salary question. He or she may even be able to run interference for you. If, for instance, he tells you what the position pays, and you tell him that you are earning that amount now and would Like to do a bit better, he might go back to the employer and propose that you be offered an additional 10%.

If no price range is attached to the job, and the interviewer continues to press the subject, then you will have to respond with a number. You cannot leave the impression that it does not really matter, that you’ll accept whatever is offered. If you’ve been making $80,000 a year, you can’t say that a $35,000 figure would be fine without sounding as if you’ve given up on yourself. (If you are making a radical career change, however, this kind of disparity may be more reasonable and understandable.)

Don’t sell yourself short, but continue to stress the fact that the job itself is the most important thing in your mind. The interviewer may be trying to determine just how much you want the job. Don’t leave the impression that money is the only thing that is important to you. Link questions of salary to the work itself.

But whenever possible, say as little as you can about salary until you reach the “final” stage of the interview process. At that point, you know that the company is genuinely interested in you and that it is likely to be flexible in salary negotiations.

24. What are your long-range goals?

Refer back to the planning phase of your job search. Don’t answer, “I want the job you’ve advertised.” Relate your goals to the company you are interviewing: ‘in a firm like yours, I would like to…”

25. How successful do you you’ve been so far?

Say that, all-in-all, you’re happy with the way your career has progressed so far. Given the normal ups and downs of life, you feel that you’ve done quite well and have no complaints.
Present a positive and confident picture of yourself, but don’t overstate your case. An answer like, “Everything wonderful! I can’t think of a time when things were going better! I’m overjoyed!” is likely to make an interviewer wonder whether you’re trying to fool him . . . or yourself. The most convincing confidence is usually quiet confidence.

10 Steps to a Successful Interview

  1. Arrive on time.
  2. Introduce yourself in a courteous manner.
  3. Read company materials while you wait.
  4. Have a firm handshake.
  5. Listen.
  6. Use body language to show interest.
  7. Smile, nod, give nonverbal feedback to the interviewer.
  8. Ask about the next step in the process.
  9. Thank the interviewer.
  10. Write a thank-you letter to anyone you have spoken to.

Interview Questions: ASP.NET

  1. Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe in the page loading process.
    inetinfo.exe is theMicrosoft IIS server running, handling ASP.NET requests among other things.When an ASP.NET request is received (usually a file with .aspx extension), the ISAPI filter aspnet_isapi.dll takes care of it by passing the request tothe actual worker process aspnet_wp.exe.
  2. What’s the difference between Response.Write() and Response.Output.Write()?
    Response.Output.Write() allows you to write formatted output.
  3. What methods are fired during the page load?
    Init() - when the page is instantiated
    Load() - when the page is loaded into server memory
    PreRender() - the brief moment before the page is displayed to the user as HTML
    Unload() - when page finishes loading.
  4. When during the page processing cycle is ViewState available?
    After the Init() and before the Page_Load(), or OnLoad() for a control.
  5. What namespace does the Web page belong in the .NET Framework class hierarchy?
    System.Web.UI.Page
  6. Where do you store the information about the user’s locale?
    System.Web.UI.Page.Culture
  7. What’s the difference between Codebehind="MyCode.aspx.cs" andSrc="MyCode.aspx.cs"?
    CodeBehind is relevant to Visual Studio.NET only.
  8. What’s a bubbled event?
    When you have a complex control, like DataGrid, writing an event processing routine for each object (cell, button, row, etc.) is quite tedious. The controls can bubble up their eventhandlers, allowing the main DataGrid event handler to take care of its constituents.
  9. Suppose you want a certain ASP.NET function executed on MouseOver for a certain button. Where do you add an event handler?
    Add an OnMouseOver attribute to the button. Example: btnSubmit.Attributes.Add("onmouseover","someClientCodeHere();");
  10. What data types do the RangeValidator control support?
    Integer, String, and Date.
  11. Explain the differences between Server-side and Client-side code?
    Server-side code executes on the server. Client-side code executes in the client's browser.
  12. What type of code (server or client) is found in a Code-Behind class?
    The answer is server-side code since code-behind is executed on the server. However, during the code-behind's execution on the server, it can render client-side code such as JavaScript to be processed in the clients browser. But just to be clear, code-behind executes on the server, thus making it server-side code.
  13. Should user input data validation occur server-side or client-side? Why?
    All user input data validation should occur on the server at a minimum. Additionally, client-side validation can be performed where deemed appropriate and feasable to provide a richer, more responsive experience for the user.
  14. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one over the other?
    Server.Transfer transfers page processing from one page directly to the next page without making a round-trip back to the client's browser. This provides a faster response with a little less overhead on the server. Server.Transfer does not update the clients url history list or current url. Response.Redirect is used to redirect the user's browser to another page or site. This performas a trip back to the client where the client's browser is redirected to the new page. The user's browser history list is updated to reflect the new address.
  15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
    Valid answers are:
    · A DataSet can represent an entire relational database in memory, complete with tables, relations, and views.
    · A DataSet is designed to work without any continuing connection to the original data source.
    · Data in a DataSet is bulk-loaded, rather than being loaded on demand.
    · There's no concept of cursor types in a DataSet.
    · DataSets have no current record pointer You can use For Each loops to move through the data.
    · You can store many edits in a DataSet, and write them to the original data source in a single operation.
    · Though the DataSet is universal, other objects in ADO.NET come in different versions for different data sources.
  16. What is the Global.asax used for?
    The Global.asax (including the Global.asax.cs file) is used to implement application and session level events.
  17. What are the Application_Start and Session_Start subroutines used for?
    This is where you can set the specific variables for the Application and Session objects.
  18. Can you explain what inheritance is and an example of when you might use it?
    When you want to inherit (use the functionality of) another class. Example: With a base class named Employee, a Manager class could be derived from the Employee base class.
  19. Whats an assembly?
    Assemblies are the building blocks of the .NET framework. Overview of assemblies from MSDN
  20. Describe the difference between inline and code behind.
    Inline code written along side the html in a page. Code-behind is code written in a separate file and referenced by the .aspx page.
  21. Explain what a diffgram is, and a good use for one?
    The DiffGram is one of the two XML formats that you can use to render DataSet object contents to XML. A good use is reading database data to an XML file to be sent to a Web Service.
  22. Whats MSIL, and why should my developers need an appreciation of it if at all?
    MSIL is the Microsoft Intermediate Language. All .NET compatible languages will get converted to MSIL. MSIL also allows the .NET Framework to JIT compile the assembly on the installed computer.
  23. Which method do you invoke on the DataAdapter control to load your generated dataset with data?
    The Fill() method.
  24. Can you edit data in the Repeater control?
    No, it just reads the information from its data source.
  25. Which template must you provide, in order to display data in a Repeater control?
    ItemTemplate.
  26. How can you provide an alternating color scheme in a Repeater control?
    Use the AlternatingItemTemplate.
  27. What property must you set, and what method must you call in your code, in order to bind the data from a data source to the Repeater control?
    You must set the DataSource property and call the DataBind method.
  28. What base class do all Web Forms inherit from?
    The Page class.
  29. Name two properties common in every validation control?
    ControlToValidate property and Text property.
  30. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?
    DataTextField property.
  31. Which control would you use if you needed to make sure the values in two different controls matched?
    CompareValidator control.
  32. How many classes can a single .NET DLL contain?
    It can contain many classes.

Web Service Questions

  1. What is the transport protocol you use to call a Web service?
    SOAP (Simple Object Access Protocol) is the preferred protocol.
  2. True or False: A Web service can only be written in .NET?
    False
  3. What does WSDL stand for?
    Web Services Description Language.
  4. Where on the Internet would you look for Web services?
    http://www.uddi.org
  5. True or False: To test a Web service you must create a Windows application or Web application to consume this service?
    False, the web service comes with a test page and it provides HTTP-GET method to test.

State Management Questions

  1. What is ViewState?
    ViewState allows the state of objects (serializable) to be stored in a hidden field on the page. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source. ViewState is used the retain the state of server-side objects between postabacks.
  2. What is the lifespan for items stored in ViewState?
    Item stored in ViewState exist for the life of the current page. This includes postbacks (to the same page).
  3. What does the "EnableViewState" property do? Why would I want it on or off?
    It allows the page to save the users input on a form across postbacks. It saves the server-side values for a given control into ViewState, which is stored as a hidden value on the page before sending the page to the clients browser. When the page is posted back to the server the server control is recreated with the state stored in viewstate.
  4. What are the different types of Session state management options available with ASP.NET?
    ASP.NET provides In-Process and Out-of-Process state management. In-Process stores the session in memory on the web server. This requires the a "sticky-server" (or no load-balancing) so that the user is always reconnected to the same web server. Out-of-Process Session state management stores data in an external data source. The external data source may be either a SQL Server or a State Server service. Out-of-Process state management requires that all objects stored in session are serializable.

Wednesday, January 23, 2008

Welcome

Dear Friends,

I am gratified to announce that I have successfully created a blog for our community ".Net Developers" on Orkut. Here you can find various resources on .Net especially on Asp.net, C#, VB.Net and Sql Server.

Your contributions to this blog would be most appreciated. Here you can post your questions/problems as well as resources on .Net which you want to share with your friends. So let's make this blog a big hit.

Regards,
Mohd Shahanshah Ansari

Created by Windy Road - Blogger port by Blogger Templates