none
Design Pattern - Extension Method RRS feed

  • Question

  • Whether Extension Method is Microsoft's implementation of Visitor Pattern and is in the form of Syntactic Sugar?!

    Thanks.

    • Moved by George Hua Friday, September 6, 2013 9:26 AM not an Office issue
    Thursday, September 5, 2013 7:37 AM

Answers

  • Hi Rajarajacholan,

    Extension Method is not the implementation of visitor pattern. The purpose of visitor pattern is to separate an algorithm from an object structure on which it operates. But the purpose of Extension Method is to add itself to any specified instance.

    And Extension Method is not Syntactic Sugar too. Syntactic Sugar is syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for human use. So I think Extension Method is nothing to do with Syntactic Sugar.

    Visitor Pattern

    Syntactic Sugar

    Extension Method

    Best Regards,


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Raj Krish Tuesday, September 10, 2013 12:09 PM
    Friday, September 6, 2013 9:40 AM
    Moderator

All replies

  • Hi,

    Since your issue is related to Extension Method, I'd like to move it to .NET Framework Class Libraries forum for more help.

    Thanks for your understanding!


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    • Edited by George Hua Friday, September 6, 2013 9:26 AM
    Friday, September 6, 2013 9:19 AM
  • Hi Rajarajacholan,

    Extension Method is not the implementation of visitor pattern. The purpose of visitor pattern is to separate an algorithm from an object structure on which it operates. But the purpose of Extension Method is to add itself to any specified instance.

    And Extension Method is not Syntactic Sugar too. Syntactic Sugar is syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for human use. So I think Extension Method is nothing to do with Syntactic Sugar.

    Visitor Pattern

    Syntactic Sugar

    Extension Method

    Best Regards,


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Raj Krish Tuesday, September 10, 2013 12:09 PM
    Friday, September 6, 2013 9:40 AM
    Moderator
  • Thank you.
    Tuesday, September 10, 2013 12:11 PM