this partial class. please help me with source code.With Partial class you can split a class into several files:
MyClass1.cs:
public partial class MyClass
{
public void method1()
{
}
}
MyClass2.cs:
public partial class MyClass
{
public void method2()
{
}
}
Look atDan Fernandez's Blog for comprehensive details on partial types.
Hope this helps,
Appan
What is it used for?
Regards
Yahya
With Partial class you can split a class into several files.
The new "code-behind" (code separation) uses Partial.
You can use it if you want to split your classes into several of files, could for example, be useful if you auto generate the classes attributes from a data source and want the application logic to be in a file that should be included into the class etc.
In the beta, the partial class that results form a code separation page (ASPX and say .CS), means that the ultimate page class that ASP.NET generates when it parses the page and creates an assembly is built from the two files. The point is that there is only one class, and one assembly. It requires no compile step within the tool, just dynamic compilation by ASP.NET when the page is accessed.
In v1.x, the model of code behind meant that the .CS file for the page created an assembly(along with other code ebhind files) and separate class that the page-generated class inherited from. (This required the Build step to produce the code behind assembly), then ASP.NET would perform class and code generation for the actual page. This model resulted in the need to replicate protected members for the top-;level controls in the code-behind and perform explicit event wire up. All that required what we call "code-spit" from the tool.
The new model does away with the need for explicit member declarations, as these are simply the declarative form of the page.
Hope this helps explain what's going on.
Tim explained some other pieces in the followingpost
0 comments:
Post a Comment