ASP.NET: VSNET2003 to VSNET2005

N

Nathan Sokalski

I just upgraded from Visual Studio .NET 2003 to Visual Studio .NET 2005.
There are several questions I have about the code differences between them
(I use VB.NET for as my language of choice):

1. 2003 used "Public Class classname" and 2005 uses "Partial Class
classname". What, if any, difference is there between these?

2. The following things are included in the #Region " Web Form Designer
Generated Code " part of 2003's code, and are not included automatically in
2005:

<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub


Control declarations, such as:
Protected WithEvents lblWebsite As System.Web.UI.WebControls.Label


Private designerPlaceholderDeclaration As System.Object


Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
InitializeComponent()
End Sub

Do I need to include any of these manually or anything else that serves
their purpose?

3. In 2003 the Page Events use clauses such as Handles MyBase.Load while
2005 uses Handles Me.Load. I am assuming that these will work the same?


I am sure that I will run into the other differences between the two, but
these are some of the important ones for me right now. Thanks.
 
B

bruce barker \(sqlwork.com\)

the main difference from 2003 to 2005, is how a page is compiled.

in 2003 when asp.net compiled an aspx, it had the page inherit from the code
behind file, which VS had compiled into a separate dll. this required the
funky double declare of controls, and linking up the events. note there are
two compiles, the codebehind into a dll by vs, and each aspx page as a
separate dll by the asp.net compiler.

in 2005 there is a new feature called partial classes. this allows a class
to be broken into two files and compiled together. VS no longer compiles the
code behind files into their own dll. the asp.net compiler does all the
work, so the codebehind is in the same dll as the aspx page. because the
codebehind and the aspx page code is merged thru the magic of partial
classes, then a control is defined in aspx, the codebehind knows about it.

-- bruce (sqlwork.com)
 
S

Steve C. Orr [MVP, MCSD]

1) A partial class just means that the class is split across one or more
files. "Partial" has no effect on whether a class is public or private.

2) No

3) Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top