Windows Phone Developers

Saturday, March 27, 2010

Partial Classes in C# (.NET)






Why to use Partial Classes?



Partial classes have many advantages. The most visible being the ability to split the class in multiple files. This is quite evident in Windows forms.


Windows forms has the class being split between two files - Form1.cs and FormDesigner.cs


Windows Forms application

partial class

Form1

{

///

/// Required designer variable.

///

private System.ComponentModel.IContainer components = null

;



And

public partial class

Form1 : Form

{

public

Form1()

{

check_whitespace();

InitializeComponent();

}

The same concept can be effectively used in the classes you create also.

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment