.Net 3.0 new feature - Partial Methods

Posted by Sksingh under C# category on | Points: 40 | Views : 2193
Typically used for auto gereration of code which will be included at runtime using System.Reflection.Emit namespace classes.
Rules :
1. Partial methods should be private,
2. Partial methods should be always void.
3. NO parameters are expected in partial methods.

  partial class Model
partial void InitializeComponent(); // partial methods should always be private
public void createView()
Console.WriteLine("view is created successfully");
// this section of the code is written in other class
partial class Model
partial void InitializeComponent()
Console.WriteLine("Implemented by other part of the class implemented in other class");
class MainClient
static void Main()
Model model = new Model();


Comments or Responses

Posted by: T.saravanan on: 6/5/2011 Level:Silver | Status: [Member] [MVP] | Points: 10
Hi Sunil,

Nice info.Kindly post your code inside the code tag.

Note: If you are new user, select a code then just click the code tag .
Posted by: Akiii on: 6/6/2011 Level:Bronze | Status: [Member] | Points: 10
hi sunil....

Nice information...
keep posting...!

Thanks and Regards
Posted by: Jayeshl on: 6/9/2011 Level:Starter | Status: [Member] | Points: 10
nice code

i really find new thinks from this post..


Jayesh L

Login to post response