Sei sulla pagina 1di 11

1. Describe the role of inetinfo.exe, aspnet_isapi.dll and aspnet_wp.exe in the page loading process.

inetinfo.exe is the Microsoft IIS server running, handling ASP.NET requests. 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 to the actual worker process aspnet_wp.exe.

2. What’s the difference between Response.Write() and Response.Output.Write()?


The latter one allows you to write formattedoutput.

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 asHTML, Unload() - when page finishes loading.

4. Where does the Web page belong in the .NET Framework class hierarchy?
System.Web.UI.Page

5. Where do you store the information about the user’s locale?


System.Web.UI.Page.Culture

6. What’s the difference between Codebehind="MyCode.aspx.cs" and Src="MyCode.aspx.cs"?


CodeBehind is relevant to Visual Studio.NET only.

7. 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.

8. Suppose you want a certain ASP.NET function executed on MouseOver over a certain button.
Where do you add an event handler?
It’s the Attributesproperty, the Add function inside that property. So
btnSubmit.Attributes.Add("onMouseOver","someClientCode();")

9. What data type does the RangeValidator control support?


Integer, String and Date.

10. Explain the differences between Server-side and Client-side code?


Server-side code runs on the server. Client-side code runs in the clients’ browser.

11. What type of code (server or client) is found in a Code-Behind class?


Server-side code.

12. Should validation (did the user enter a real date) occur server-side or client-side? Why?
Client-side. This reduces an additional request to the server to validate the users input.

13. What does the "EnableViewState" property do? Why would I want it on or off?
It enables the viewstate on the page. It allows the page to save the users input on a form.

14. What is the difference between Server.Transfer and Response.Redirect? Why would I choose one
over the other?
Server.Transfer is used to post a form to another page. Response.Redirect is used to redirect the user to
another page or site.

15. Can you explain the difference between an ADO.NET Dataset and an ADO Recordset?
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. Can you give an example of what might be best suited to place in the Application_Start and
Session_Start subroutines?
This is where you can set the specific variables for the Application and Session objects.

17. If I’m developing an application that must accommodate multiple security levels though secure
login and my ASP.NET web application is spanned across three web-servers (using round-robin load
balancing) what would be the best approach to maintain login-in state for the users?
Maintain the login state security through a database.

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.
Base Class 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.
For 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.

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 some 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. What tags do you need to add within the asp:datagrid tags to bind columns manually?
Set AutoGenerateColumns Property to false on the datagrid tag

31. What tag do you use to add a hyperlink column to the DataGrid?

32. What is the transport protocol you use to call a Web service?
SOAP is the preferred protocol.

33. A Web service can only be written in .NET?


False

34. What does WSDL stand for?


Web Services Description Language

35. Where on the Internet would you look for Web services?
http://www.uddi.org

36. 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

37. Which control would you use if you needed to make sure the values in two different controls
matched?
CompareValidator Control

38. To test a Web service you must create a windows application or Web application to consume this
service?
False, the webservice comes with a test page and it provides HTTP-GET method to test.

39. How many classes can a single .NET DLL contain?


It can contain many classes.

40. Briefly explain how code behind works and contrast that using the inline style.
Many of the web developers that are currently moving to ASP.NET were previously ASP developers, which
made them used to developing their script code inline with the HTML.
This coding style of using inline code is still available within the ASP.NET framework, but a new coding style
designed for large team development has also been introduced with ASP.NET this has been dubbed code-
behind.
This coding style places all the code that is to be executed by the server into separate files for each .aspx
page. This allows web designers who specialize in the HTML development of a site, and application
developers who specialize in the programming logic of the site to work together in a way that the page
designer does not disturb the code in the page. This also allows a company who is interested in protecting
it’s investment or who are developing web applications for resale to distribute just the .aspx files and the
compiled code-behind files as a .dll file for the site.

There are three ways of working with .aspx pages.


1. Inline code that is compiled on the web server as it is needed.
2. Code-behind files that are compiled into a .dll file and then removed from production.
3. Code-behind files that are compiled on the web server as they are needed.
With these options in mind it becomes very important to consider how a developer will work with .aspx pages
in ASP.NET.

41. What are HTML controls, Web controls, and server controls?
HTML controls- represent common HTML elements and are available through the HTML tab of the Visual
Studio .NET toolbox. You can drag these controls to a Web form and set their properties in the Properties
window. An HTML control, such as Text Field or Label, is converted to its appropriate HTML equivalent, such
as the <INPUT> and <DIV> element, respectively, in the source code of the ASPX file. All the HTML controls
are automatically placed inside an HTML <FORM> element.

HTML server controls are similar to HTML controls with the added feature of server-side availability. You can
convert any HTML control to run as an HTML server control by adding a runat="server" attribute to its
declaration. You can accomplish the same task visually by right-clicking an HTML control and selecting Run
As Server Control from the shortcut menu.

Web server controls provide a higher level of abstraction than HTML server controls because their object
model matches closely with the .NET Framework rather than matching with the requirements of HTML
syntax.

The Web server controls have several advanced features, including

Web server controls provide a rich object model that closely matches with the rest of the .NET Framework.

Some Web server controls provide richer functionality, such as the Calendar control, AdRotator control, and
so on, not available with HTML controls.

Web server controls have advanced features such as automatic browser detection, automatic postback, and
event bubbling.

Web server controls are declared in code explicitly by prefixing the class name of the Web server control
with the namespace asp and separating both with a colon (:), as well as including the runat="server"
attribute in its definition. For example, a Label Web server control can be declared in code as <asp:Label
runat="server"/>.

Most Web server controls derive their functionality from the WebControl class of the
System.Web.UI.WebControls namespace.

42. Briefly explain how the server control validation controls work.
User Input Validation
ASP.NET provides a set of Web server controls called validation controls that provide sophisticated
validation on both the client side and the server side depending on the validation settings and the browser's
capabilities.

ASP.NET ensures that validations are performed on the server side even if they were already performed on
the client side. This ensures that validations are not bypassed if a malicious user circumvents client-side
validation. If the client-side validation fails, the server-side validation is never performed.

some validator controls are - Requiredfieldvalidator, RangeValidator, CompareValidator,


RegularExpressionValidator, CustomValidator, ValidationSummary.you may want to mention about
Page.Validate() Method and Page.IsValid Property.

43. Briefly explain what user controls are and what server controls are and the differences between
the two.
A user control could simply be an extension of the functionality of an existing server control(s) (such as an
image control that can be rotated or a calendar control that stores the date in a text box). Or, it could consist
of several elements that work and interact together to get a job done (such as several controls grouped
together that gather information about a user's previous work experience).

An ASP.NET control (sometimes called a server control) is a server-side component that is shipped with
.NET Framework. A server control is a compiled DLL file and cannot be edited. It can, however, be
manipulated through its public properties at design-time or runtime. It is possible to build a custom server
control (sometimes called a custom control or composite control).

In contrast, a user control will consist of previously built server controls (called constituent controls when
used within a user control). It has an interface that can be completely edited and changed. It can be
manipulated at design-time and runtime via properties that you are responsible for creating. While there will
be a multitude of controls for every possible function built by third-party vendors for ASP.NET, they will exist
in the form of compiled server controls, as mentioned above. Custom server controls may be the .NET
answer to ActiveX Web controls.

Read more - http://www.15seconds.com/issue/020319.htm

44. Briefly explain how server form post-back works (perhaps ask about view state as well).
One of the most important features of the ASP.NET environment is the ability to declare controls that run on
the server, and post back to the same page. Remember the days of classic ASP? We would create a form
which would accept the user's input, and then we would most probably have to create another page that
would accept all those inputs, either through HTTP GET or POST, and perform some kind of validation,
display and action. Sometimes, even a third page was necessary to perform our actions. This wasted a lot of
time and complicated things when you had to make a change. But of course, this is not necessary any more
with ASP.NET. There is no need to create second pages that accept the inputs of the first, process them and
so on. Form fields and other controls can be declared to run on the server, and the server simply posts the
page back to itself and performs all the validation, display and actions. Our life as web developers has
become a million times better. But how exactly is this done?

When a control is declared to run on the server, a VIEWSTATE is created which remembers the ID of that
control, and the method to call when an action is performed.submit event calls the javascript function
__doPostBack (that's 2 underscore symbols in front of it). You do not write this function, instead it is
generated by the ASP.NET engine and automatically included in our page. It submits the form to the same
page, and accepts 2 arguments:

eventTarget: the control doing the submission


eventArgument: any additional information for the event

At least one control needs to be set to Visible, for the server to generate the __doPostBack function in our
page. Even if we have numerous web controls declared to run on the server, but they are all set to
Visible=false, then the javascript function will not be included and we will not be able to perform any actions.

45. Can the action attribute of a server-side <form> tag be set to a value and if not how can you
possibly pass data from a form page to a subsequent page. (Extra credit: Have you heard of comdna.
:-)
.NET pages are set to postback to themselves by default and this cannot be changed. You must process
your form data in the same page if you want to use .NET controls. It's the way it works.

<FORM ACTION="nextpage.aspx" RUNAT="server">


Will not work. Your form action will be over-written to the current page no matter what you try. Unless of
course you remove the runat="server" which then means you are using forms under Classic ASP again and
.NET features like validation controls will be ignored.

If you truly want to move to another page when you submit your form you can. However; you must process
the form data from the page you are on first. Then redirect to the next page using Response.Redirect or
Server.Transfer. If you care to pass the form values to the next page then you must do it in the query string.
Read more -http://www.tconsult.com/aspnet/action.aspx

46. Briefly describe the role of global.asax.


The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for
responding to application-level events raised by ASP.NET or by HttpModules. The Global.asax file resides in
the root directory of an ASP.NET-based application. At run time, Global.asax is parsed and compiled into a
dynamically generated .NET Framework class derived from the HttpApplication base class. The Global.asax
file itself is configured so that any direct URL request for it is automatically rejected; external users cannot
download or view the code written within it.

global.asax is responsible for handling higher-level application events such as Application_Start,


Application_End, Session_Start, Session_End

Read more - http://www.codetoad.com/asp.net_globalasax.asp

47. How would ASP and ASP.NET apps run at the same time on the same server?
http://www.iprisma.com/aspbridge/faq.htm has some FAQs on how to work(migrate) with (from) asp and(to)
asp.net

48. What are good ADO.NET object(s) to replace the ADO Recordset object.
ADO.net Datasets replace the ADO recordset objects. I did not find any good article on any good objects in
ado.net. but reading the links below should provide the information to answer the question.
Read more - http://www.eggheadcafe.com/articles/20010920.asp
http://builder.com.com/5100-6388-5047655.html
good discussion about ado vs ado.net -
http://discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=5029

49. What is the correct language to code ASP.NET pages with?


(The only correct answer would be C#. :-) Maybe this should be the first question.

50. What is the root namespace for all types?


System.

51. What is CLR ? Differentiate between CLR & CTS.


Common Language Runtime. The CLR is a set of standard resources responsible for execution of code
developed using .NET language. .Net compiler generates intermediate language (IL) which is then compiled
using JIT to m/c code. It provides access to common functionalities to all languages via Base Class
Libraries. CLR is replacement to win32 APICross-language integration, especially cross-language
inheritance. Automatic memory management (garbage collection), which manages object lifetime so that
reference counting is unnecessary. Self-describing objects, which make using Interface Definition Language
(IDL) unnecessary. The ability to compile once and run on any CPU and operating system that supports the
runtime.
Common Language Specification. This is a subset of the CTS which all .NET languages are expected to
support. The idea is that any program which uses CLS-compliant types can interoperate with any .NET
program written in any language. In theory this allows very tight interop between different .NET languages -
for example allowing a C# class to inherit from a VB class.

52. To which namespaces do Trace and Debug belong?


Systems.Diagnostics

53. To which namespaces does ColumnMapping belong?


[System.Data namespace] [DataColumn class] ColumnMapping

54. In order to get assembly info which namespace we should import?


55. DIfferentiate between Friend and Protected Friend.
The five access types are Public, Protected, Friend, Protected Friend, and Private.
Entities declared with the Public modifier have Public access. There are no restrictions on the use of Public
entities.
Entities declared with the Protected modifier have Protected access. Protected access can only be specified
on members of classes (both regular type members and nested classes) or on Overridable members of
standard modules and structures (which must, by definition, be inherited from System.Object or
System.ValueType). A Protected member is accessible to a derived class, provided that either the member is
not an instance member, or the access takes place through an instance of the derived class. Protected
access is not a superset of Friend access.
Entities declared with the Friend modifier have Friend access. An entity with Friend access is accessible only
within the program that contains the entity declaration.
Entities declared with the Protected Friend modifiers have the union of Protected and Friend access.
Entities declared with the Private modifier have Private access. A Private entity is accessible only within its
declaration context, including any nested entities.

56. What is an abstract class?


Answer - Abstract class is a class that has no direct instances, but whose descendants may have direct
instances. There are case i which it is useful to define classes for which the programmer never intends to
instantiate any objects; because such classes normally are used as bae-classes in inheritance hierarchies,
we call such classes abstract classes These classes cannot be used to instantiate objects; because abstract
classes are incomplete. Derived classes called concrete classesmust define the missing pieces.

Note : - Virtual method has an implementation & provide the derived class with the option of overriding it.
Abstract method does not provide an implementation & forces the derived class to override the method.

57. What is the difference between abstract class and an interface? What is shadowing ?
Differentiate between Overriding and Overloading.
Answer - Interfaces, like classes, define a set of properties, methods, and events. But unlike classes,
interfaces do not provide implementation. An interface represents a contract, and a class that implements an
interface must implement every aspect of that interface exactly as it is defined.

It is important to note here that an interface is very different from a base class. An interface is implemented,
not extended.
1. A class can implement multiple interfaces.
2. An interface cannot contain data declarations but you can declare properties.
3. All method declarations in an interface are public.
4. There can be no implementation in an interface.
5. The class implementing the interface must provide implementation code.
6. An interface can be derived from another interface

An abstract class is a class that cannot be instantiated, but must be inherited from. An abstract class may be
fully implemented, but is more usually partially implemented or not implemented at all, thereby encapsulating
common functionality for inherited classes.

When you have a class that contains methods that have no implementation (i.e. abstract methods), the class
is said to be abstract as well. An abstract method is simply a shell or place-marker for a method that will be
defined later in a derived class. The intention of abstract methods is to force every derivation of the class to
implement those methods. If a derived class does not implement an abstract method, then that class must
also be declared as abstract.

Shadowing is used when 2 programmers come up with same method in the same class one of the methods
gets shadowed by scope or inheritance.

Overriding - you override a virtual class.


Overloading - you overload a method with different number of parameters or different type of parameters.

58. How do you declare a static variable and what is its lifetime?
Answer -

59. How do you get a record no from 5 to 15 from a dataset of 100 records?
Answer -

60. Differentiate between Dataset and Recordset.


Answer - Similar to the DataSet, a Recordset could be disconnected from its data store and therefore act as
an in-memory cache of data. Of course, it could also be used in a connected model depending on the cursor
options that were set. Although the Recordset object stored multiple versions of each column for each of its
rows, it was not by nature able to represent multiple tables without the use of the Data Shape Provider. The
Recordset was not XML-based and could not be serialized to XML easily or flexibly. Finally, a Recordset was
not independent of a data store because it tracked a Connection object and through its methods could send
queries to the data source to populate, update, and refresh its data. To that end, the Recordset contained
functionality found in the ADO.NET DataSet, data reader, and data adapter objects.

61. Why is Datareader considered useful?


A DataReader is a read-only stream of data returned from the database as the query executes. It only
contains one row of data in memory at a time and is restricted to navigating forward only in the results one
record at a time. The DataReader does support access to multiple result sets, but only one at a time and in
the order retrieved. Just as in the original version of ADO, the data is no longer available through the
DataReader once the connection to the data source is closed, which means a DataReader requires a
connection to the database throughout its usage. Output parameters or return values are only available
through the DataReader once the connection is closed.

62. How do you call and execute a SP in .NET?


Link - http://www.123aspx.com/redir.aspx?res=31194

63. What is DLL hell?


Most of you have probably experienced DLL Hell, though you may not have heard of it described as such. If
not, you've probably heard horror stories from friends or colleagues. The story goes something like this: An
end-user or customer calls. Your program is behaving strangely, or no longer loads. Did another program
install an older DLL, VBX or ActiveX file on their system? Or maybe a newer, but incompatible version? Is it
a conflict due to an incompatible DLL already loaded in memory? Has the PATH environment setting
changed? Is the file properly registered in the registry? Is a required file missing? You can literally spend
hours trying to figure out what is wrong with a customer’s machine, and why their applications will no longer
run.

.... Every application was self-contained. A program would consist of a single executable (EXE) file. Complex
applications might consist of several executables that were chained to each other. One thing, however, was
certain - the executables that accompanied a particular application could be used only by that application.
For most programs, you could distribute all of the files used by that program without being concerned that
other products might interfere with yours.

In the past few years the size of application files has grown dramatically. The Windows operating
environment took advantage of a capability called dynamic linking to allow code modules to be shared by
applications. The most important demonstration of the use of this capability is Windows itself - the code
modules that contain the functions that make Windows work (the Windows API), are shared by all Windows
applications. A code module that can be shared in this way is called a dynamic link library and normally has
the extension .DLL.

64. What is versioning in .NET?


Answer - Each assembly has a four-part version number as part of its identity. Including the version as part
of the identity is essential to distinguish different versions of an assembly for the purposes of side-by-side.
This compatibility version number is physically represented as a 4-part number with the following format:

MajorVersion.MinorVersion.BuildNumber.Revision.
The parts of the version number are major, minor, build and revision. There are no semantics applied to the
parts of the version number. That is, the common language runtime does not infer compatibility or any other
characteristic of an assembly based on how the version number is assigned (version 1.0.0.0 of some
assembly and version 2.1.0.2 are completely different identities as far as the class loader is concerned). As
a developer you are free to change any portion of this number as you see fit. Even though there are no
semantics applied to the format of the version number, individual organizations will likely find it useful to
establish conventions around how the version number is changed. This helps maintain consistency
throughout an organization and makes it easier to determine things like which build a particular assembly
came from. One typical convention is as follows:

Major or minor. Changes to the major or minor portion of the version number indicate an incompatible
change. Under this convention then, version 2.0.0.0 would be considered incompatible with version 1.0.0.0.
Examples of an incompatible change would be a change to the types of some method parameters or the
removal of a type or method altogether.

Build. The Build number is typically used to distinguish between daily builds or smaller compatible releases.

Revision. Changes to the revision number are typically reserved for an incremental build needed to fix a
particular bug. You'll sometimes hear this referred to as the "emergency bug fix" number in that the revision
is what is often changed when a fix to a specific bug is shipped to a customer.

65. What are the ASP.NET list controls and differentiate between them?
Answer - In real-world web applications most of the time data is retrieved from the database source and
displayed in tabular or list format. In theory we got to be spending most of our time solving application logic
but in practice we spend most of the time in managing the state of the data between web pages and
displaying the data. It looks like Microsoft has been listening to these problems ;asp.net provides new set of
list controls like Repeater, DataList and DataGrid which will help the developers save lot of time in this area.
All these controls are built with a specific purpose in mind. It’s good to know the purpose of the controls so
as to reap the maximum benefit from these controls.

These controls have the data binding property where you can retrieve data from the database and bind to
the control and define how you want the data to look like and the rest of the work is done with great ease.
Let us start looking closely and find what each one of these controls has to offer.

Repeater control is one of the simplest among the controls. It basically iterates through the bound-data and
displays it in a single list. All we got to do is just bind the data to the Repeater control and tell the control how
we want the data to look like using controls Template. This is useful for;example to display list of employees,
products, articles where there is no sorting, editing and paging of data is needed.

DataList is one step a head of the repeater control, it can do all that repeater can do and has additional
flexibility to control the layout of the list. For example this has features where you can mention the direction
of the list like horizontal,vertical and also select, edit, update and cancel items by using there respective
events. This control is very useful when you want to display list of products and also have some additional
features like adding then to shopping cart or any other editable capability.

DataGrid control is the most powerful and fascinating among the three controls.It displays data in a tabular
from . By default, the DataGrid displays data in read-only mode, but the DataGrid is also capable of
automatically displaying the data in editable controls at run-time. The DataGrid control can also create the
Select, Edit, Update, and Cancel buttons. Additionally paging, sorting are inbuilt feature. This control can be
used whenever we require displaying data in a grid format and requires a whole range of functionality like
sorting and paging.
more info - http://www.code101.com/Code101/DisplayArticle.aspx?cid=1

66. What is the difference between ASP State Management and ASP.NET State Management?

67. How can we pass information between 2 asp.net pages?


read the information on the link and follow the pages till the end.
link - http://authors.aspalliance.com/aspxtreme/webapps/passingcontrolvaluesbetweenpages.aspx

68. Diff between Web User Control and Web Custom Control.

Answer - If none of the existing ASP.NET server controls meet the specific requirements of your applications,
you can create either a Web user control or a Web custom control that encapsulates the functionality you
need. The main difference between the two controls lies in ease of creation vs. ease of use at design time.

Web user controls are easy to make, but they can be less convenient to use in advanced scenarios. You
develop Web user controls almost exactly the same way that you develop Web Forms pages. Like Web
Forms, user controls can be created in the visual designer, they can be written with code separated from the
HTML, and they can handle execution events. However, because Web user controls are compiled
dynamically at run time they cannot be added to the Toolbox, and they are represented by a simple
placeholder glyph when added to a page. This makes Web user controls harder to use if you are
accustomed to full Visual Studio .NET design-time support, including the Properties window and Design view
previews. Also, the only way to share the user control between applications is to put a separate copy in each
application, which takes more maintenance if you make changes to the control.

Web custom controls are compiled code, which makes them easier to use but more difficult to create; Web
custom controls must be authored in code. Once you have created the control, however, you can add it to
the Toolbox and display it in a visual designer with full Properties window support and all the other design-
time features of ASP.NET server controls. In addition, you can install a single copy of the Web custom
control in the global assembly cache and share it between applications, which makes maintenance easier.

69. What is an indexed property?


Answer - So, the notion of properties is to define a way to access data that helps code readability while
preserving encapsulation. Indexed Properties is a similar notion, however the “friendly” field-like access of
regular Properties is replaced with the familiar array-style indexing. Take the ToDo class example below:

using System;
namespace ExampleToDo {
public class ToDo {
private string[] my_tasks;
public ToDo() {
my_tasks = new string[10];
}
public string this[int index]
{
get
{
return my_task[index];
}
set
{
return my_task[index] = value;
}
}
}
}
ToDo is a simple class that basically wraps an array of type string. However, notice, the Indexed Property (or
indexer) defines access to the array. Thus, you’re providing array-like access to “this” object, the class ToDo.
The indexer returns a string and is implemented to index on values of type int. The beauty of indexers is that
we could have defined the type we are indexing on to be something else, a string or perhaps a class we
have written.

will be glad if any one can explain indexer property. I dont think I understood this clearly.

70. I have 2 buttons on an asp.net page(.aspx). I want to execute same routine clicking on 2 buttons.
How do I do it?

71. How do we sort the data from a Dataset?


link - http://www.developerfusion.com/show/3801/

Potrebbero piacerti anche