PageFlow - XXX.designer.vb Vs XXX.vb whats the difference

Topics: Web Client Software Factory, UIP Application Block discussion, User Forum
Aug 21, 2007 at 8:56 AM
i was just wondering what is the difference between two. anyone knows?


regards,
martin
Aug 21, 2007 at 4:39 PM
These files are parts of the XXX partial class. Here’s a quote from the Create Elegant Code With Anonymous Methods, Iterators, And Partial Classes MSDN article:


Partial Types
C# 1.0 requires you to put all the code for a class in a single file. C# 2.0 allows you to split the definition and implementation of a class or a struct across multiple files. You can put one part of a class in one file and another part of the class in a different file by using the new partial keyword. For example, you can put the following code in the file MyClass1.cs:

public partial class MyClass
{
   public void Method1() {...}
}

In the file MyClass2.cs, you can insert this code:

public partial class MyClass
 
{
   public int Number;   
   public void Method2() {...}
}

In fact, you can have as many parts as you like in any given class. Partial type support is available for classes, structures, and interfaces, but you cannot have a partial enum definition.
Partial types are a very handy feature. Sometimes it is necessary to modify a machine-generated file, such as a Web service client-side wrapper class. However, changes made to the file will be lost if you regenerate the wrapper class. Using a partial class, you can factor those changes into a separate file. ASP.NET 2.0 uses partial classes, storing the machine-generated part of the page separately in memory. Windows® Forms uses partial classes to store the visual designer output of the InitializeComponent method as well as the member controls. Partial types also enable two or more developers to work on the same type while both have their files checked out from source control without interfering with each other.


Hope it helps!

Luciano G. Panaro
http://staff.southworks.net/lpanaro