Quantcast
Channel: .net Brainwork » C#
Viewing all articles
Browse latest Browse all 10

Tip: C# 3.0 Partial Methods

$
0
0
One other interesting new feature in C# 3.0 are partial methods. Have you ever crossed a partial class with something like: [crayon-51dafc64f393f/] Lets see how this can be done and, by using reflector, check out the compiled result. In our partial class, let’s supose we have this: [crayon-51dafc64f3946/] Notice the partial void method. This indicates the compiler that the MyPartialMethod() method belongs to this class, but it’s defined somewhere else. So in our other TestClass partial class, we can have something like this: [crayon-51dafc64f394d/] Interesting huh? This is specially usefull when you have generated code (for instance Linq class Designer) that implements this [...]

Viewing all articles
Browse latest Browse all 10

Trending Articles