Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

 
 
 
DZone MVB

Links

Social

C# and Partial Classes

.Net 2.0 provided us with new feature called partial classes. Using partial classes we can use multiple files to keep the code of same class. Yes - we can put some methods to one file and the others to another file. Although partial classes may be extremely useful they can be also used to ruin system's technical design if developers don't know what happens behind the compiler.

 

NB! This blog is moved to gunnarpeipman.com

Click here to go to article

Comments

Granville Barnett said:

I'm not a fan of partial classes or methods, the only use they have is providing a cleaner way to extend/modify designer generated code.

# June 10, 2008 6:26 PM

NJ said:

how to use the partial classes in web applications.

Can somebody give me any example of _Default.aspx.cs.How to create partial class for it.

# July 10, 2008 6:59 AM

jayesh said:

it really very nice.

# October 9, 2010 3:11 AM

nagaraju said:

It is really Good example

# December 12, 2010 11:59 AM

amresh pandey said:

so if one method takes 16 bytes and other one takes 16 bytes, then will the partial class will have 32 bytes of memory

# March 14, 2012 9:46 AM