Why cant partial methods be public if the implementation is in the same assembly?

Posted by Simon on Stack Overflow See other posts from Stack Overflow or by Simon
Published on 2010-01-08T00:54:04Z Indexed on 2010/03/19 2:21 UTC
Read the original article Hit count: 387

Filed under:
|
|

According to this http://msdn.microsoft.com/en-us/library/wa80x488.aspx

"Partial methods are implicitly private"

So you can have this

// Definition in file1.cs
partial void Method1();

// Implementation in file2.cs
partial void Method1()
{
  // method body
}

But you cant have this

// Definition in file1.cs
public partial void Method1();

// Implementation in file2.cs
public partial void Method1()
{
  // method body
}

But why is this? Is there some reason the compiler cant handle public partial methods?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#