1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Partial Methods - C# 3.0

Discussion in 'C#' started by sigmainfo, Jul 1, 2013.

  1. #1
    Here is a class that might benefits you.

    I was going through MSDN site and I came to know that there is a new features of C# 3.0 called Partial Methods.

    Partial methods enable the implementer of one part of a class to define a method, similar to an event. The implementer of the other part of the class can decide whether to implement the method or not. If the method is not implemented, then the compiler removes the method signature and all calls to the method. Therefore, any code in the partial class can freely use a partial method, even if the implementation is not supplied. No compile-time or run-time errors will result if the method is called but not implemented.

    Partial methods are especially useful as a way to customize generated code. They allow for a method name and signature to be reserved, so that generated code can call the method but the developer can decide whether to implement the method. Much like partial classes, partial methods enable code created by a code generator and code created by a human developer to work together without run-time costs.

    See the below example :


    partial void DoSomething();

    partial void DoSomething()
    // Some Code
    sigmainfo, Jul 1, 2013 IP