Design Pattern series learned from FLC-structural pattern (1)-adapter

Source: Internet
Author: User

The adapter mode is a mode that allows one interface to be compatible with and adapt to another common interface.

 

Adapter Mode

Http://zh.wikipedia.org/wiki/adapter Mode

Adapter pattern is sometimes called a packaging style or packaging. Transfers the interface of a class to what the user expects. An adaptation means that a class cannot work together because the interface is incompatible. The method is to wrap its own interface in an existing class.

 

Adapter mode in FCL

A typical example is the windowsformshost class.

Allows elements that host Windows Forms controls on the WPF page.

That is, adapt the Windows Forms control to the frameworkelement of WPF.

The structure is as follows:

 

ExampleCode:

    windowsformshost  > 
WF: maskedtextbox X: name = "mtbdate" mask =" 00/00/0000 " />
windowsformshost >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.