什么是构建自定义控件的最佳设计模式 [英] what is the best design pattern for a building a custom control

查看:57
本文介绍了什么是构建自定义控件的最佳设计模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


 


我们正在创建自定义Silverlight控件,我们可能会添加新的功能,确保我们在不改变现有功能的情>

 


谢谢-Nen

解决方案

你可以添加一个抽象类。



例如下面的示例代码中,b
$ b公共扣押类别CustMClass

{

   //现有的自定义类功能方法



   //为新功能添加新方法

}



因此,当您将此抽象类继承到示例中显示的派生类时代码如下所示.....


公共类DerivedCls:CustMClass

{

  //里面 对于类,您可以继承内部定义的新方法   //在 抽象类。


}


Hi all,

 

we are creating a custom silverlight control and we might add new functionality down the line, what would be the best design pattern to ensure we add new functionality to the control without changing the existing functionality??

if possilbe please point us to any materials...

 

thanks -Nen

解决方案

You can add a abstract class .

For example in the sample code below

public abastract class CustMClass
{
   //existing methods of custom class functionality

   // adding new methods for new functionality
}

So when you inherit this abstract class to a derived class which is shown in the sample code which is given below.....

public class DerivedCls : CustMClass
{
  //inside the  dervied class , you can inherit the new methods which is defined in inside   //the  abstract class.

}


这篇关于什么是构建自定义控件的最佳设计模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆