当前位置:首页 » 服务器技术
开发技术指南» 文章正文
    引言: 设计模式c#NT-FAMILY: 宋体; mso-ascii-f
 

 

    摘要:[system.runtime.interopservices.dllimport("gdi32.dll")]public static extern long bitblt (intptr hdcdest, int nxdest, int nydest, int nwidth, int nheight, intptr hdcsrc, int nxsrc, int nysrc, int dwrop);private bitmap mem......
 ·使用c#拷贝string到struct    »显示摘要«
    摘要:使用c#拷贝string到struct by dgiljr 介绍 本文介绍使用c#拷贝string到struct 。 代码using system;using system.runtime.interopservices;using system.text; class class1{ [structlayout(layoutkind.sequential, charset=charset.unicode)] public struct mystr......


设计模式c#语言描述——合成(Composite)模式
设计模式c#语言描述——合成(composite)模式

*本文参考了«java与模式»的部分内容,适合于设计模式的初学者。 【相关文章:网络与社会——我的观点(探讨)

  【扩展阅读:JGraph 常见问题解答

合成模型模式属于对象的结构模式,有时又叫做部分-整体模式。合成模式将对象组织到树结构中,可以用来描述整体与部分的关系。合成模式可以使客户端将单纯元素与复合元素同等看待。如文件夹与文件就是合成模式的典型应用。根据模式所实现接口的区别,合成模式可分为安全式与透明式两种。 【扩展信息:性能测试工具篇之loadrunner -

 

 

安全式的合成模式要求管理聚集的方法只出现在树枝构件类中,而不出现在树叶构件类中。类图如下所示:

涉及到三个角色:

 

抽象构件(component):这是一个抽象角色,它给参加组合的对象定义公共的接口及其默认的行为,可以用来管理所有的子对象。合成对象通常把它所包含的子对象当做类型为component的对象。在安全式的合成模式里,构件角色并不定义出管理子对象的方法,这一定义由树枝构件对象给出。

树叶构件(leaf):树叶对象是没有下级子对象的对象,定义出参加组合的原始对象的行为。

树枝构件(composite):代表参加组合的有下级子对象的对象。树枝构件类给出所有的管理子对象的方法,如add(),remove()等。

 

component:

public interface component

{

     void sampleoperation();

 

}// end interface definition component

 

leaf:

public class leaf  : component

{

     public void sampleoperation()

{

     }

}// end class definition leaf

    

composite:

     public class composite :component

     {

         private arraylist componentlist=new arraylist();

 

         public void sampleoperation()

         {

              system.collections.ienumerator myenumerator = componentlist.getenumerator();


...   下一页
    摘要:从这篇对话中我们不难看出下一步directx技术的发展方向,微软将力推.net上的directx技术,并且未来的xna平台更是令人期待! directx 9.0 direct3d graphics with visual basic .net posted april 30, 2004 chat date: march 30, 2004 please note: portions of this transcript have been......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE