Understanding and Using Partial Classes in C#
page 1 of 8
Published: 28 Dec 2007
Abstract
In this introductory article, Brendan describes how partial classes work and how to create partial classes. He walks you through when to use partial classes as well as how to implement multiple interfaces with partial classes. The examples used will help beginners learn about this useful technology.
by Brendan Enrick
Feedback
Average Rating: 
Views (Total / Last 10 Days): 23587/ 476

Introduction

One great addition to C#, (also added into VB, but I don't cover that much here) introduced with the .NET Framework 2.0, is support for partial classes. This is a very powerful tool made available to developers. It allows you to have multiple pieces of a class definition. Functionally, partial classes are not at all different from classes written as full classes. Which means you can have one single class definition or a class written as a few distinct parts, so you need not worry about partial classes breaking existing functionality.

If you've done any ASP.NET work since 2.0 you've probably already seen partial classes. Perhaps you did not know you were working with them, but with ASP.NET sites every page created is actually using partial classes. The other part of the partial class is created from the .aspx file.


View Entire Article

Article Feedback

Title:  
Name:  
Url: ( Optional )
Comment:  
Please add 3 and 4 and type the answer here:

User Comments

Title: Thank you   
Name: phil
Date: 7/1/2009 8:01:46 PM
Comment:
Thanks for posting this. I despise .net but I have to do it at work so its nice to find articles that teach the concepts rather than syntax.
Title: Well written   
Name: Satyajeet
Date: 6/4/2009 3:43:57 PM
Comment:
Hey dude,
I'm a developer starting of with C# and .NET rather late. But I think this is an excellent article. And I pity some of the morons who've barely got enough grasp over English to criticize you. This article is extremely crisp and helpful, and so thanks a lot!
Title: confuseeeeeeeeee   
Name: sagar
Date: 1/29/2009 1:48:30 AM
Comment:
Hi.. i am cleared abt partial class in c#.... but u r article mix with aspx... ca u clarify this
Title: partial classes   
Name: shraddha
Date: 1/13/2009 4:12:44 AM
Comment:
very good article
Title: I am heap to get you   
Name: zinabu Alemayehu
Date: 11/8/2008 10:00:40 AM
Comment:
I need some help from you based on the asp,c#,and vb.if you get full of code about some project please send to me via my email.

I always Thank u.........
Title: Thank you   
Name: Shawn F.
Date: 9/23/2008 10:55:07 AM
Comment:
Thanks for taking the time to post this. It helps clear things up.

BTW...You're able to describe things well enough for me.
Title: not decribe well   
Name: vivek rai
Date: 5/4/2008 7:21:53 AM
Comment:
u r not able to decribe well....

Product Spotlight
Product Spotlight 
Learn More






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2009 ASPAlliance.com  |  Page Processed at 7/3/2009 7:02:56 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search