请问private System.ComponentModel.Container components = null是什么意思?

问题描述

我在windows应用程序中有两处代码不明白,请教一下:1、privateSystem.ComponentModel.Containercomponents=null是什么意思?2、protectedoverridevoidDispose(booldisposing){if(disposing){if(components!=null){components.Dispose();}}base.Dispose(disposing);}这几句是什么意思?

解决方案

解决方案二:
首先说,Dispose是关闭对象并释放所使用的资源的方法。//定义了一个私有成员components,初始化值为null1、privateSystem.ComponentModel.Containercomponents=null是什么意思?//重载了方法Dispose2、protectedoverridevoidDispose(booldisposing){if(disposing)//当参数disposing是true时,{if(components!=null)//如果components不是null,就调components本身的Dispose方法{components.Dispose();}}base.Dispose(disposing);//调用基类的Dispose方法}

时间: 2024-07-30 15:11:24

请问private System.ComponentModel.Container components = null是什么意思?的相关文章

c#- System.ComponentModel.Container components啥意思?

问题描述 System.ComponentModel.Container components啥意思? private System.ComponentModel.Container components = null是什么意思? 为什么和 protected override void Dispose (bool disposing) { if(disposing && (components != null)) { components.Dispose(); } base.Dispos

请问这段代码为什么输出null,求大神解答程序执行的顺序?

问题描述 请问这段代码为什么输出null,求大神解答程序执行的顺序? public class xieCheng { private String baseName="Base"; public xieCheng(){ this.callName(); } public void callName(){ System.out.println(baseName); } } public class Sub extends xieCheng { private String baseNam

电脑问题-System.ComponentModel.Win32Exception:

问题描述 System.ComponentModel.Win32Exception: System.ComponentModel.Win32Exception: 由于应用程序配置不正确,应用程序未能启动.重新安装应用程序可能会纠正这个问题. 解决方案 http://www.cnblogs.com/songling/archive/2011/05/10/2042290.html

请教“System.ComponentModel.Win32Exception: 创建窗口句柄时出错。”

问题描述 **************************『2008-12-079:07:53』********************************System.ComponentModel.Win32Exception:创建窗口句柄时出错.在System.Windows.Forms.NativeWindow.CreateHandle(CreateParamscp)在System.Windows.Forms.Control.CreateHandle()在System.Window

急求valuetype “system.int32” 不能为null怎么解决

问题描述 privatevoidbutton1_Click(objectsender,EventArgse){if(listBox1.SelectedIndex>=0){try{stringurl="http://apis.baidu.com/apistore/weatherservice/recentweathers?cityname=";//HttpWebRequest不建议使用WebClientclient=newWebClient();client.Headers.Add

.net 里面 protected private 的变量也可以访问

变量|访问 通过 原数据可以访问,我是访问后,才发现自己怎么都操作私有字段了呢 参考代码 public class L3Data : System.ComponentModel.Component {  private System.ComponentModel.Container components = null;        private  Page _page;  private  ArrayList LiteralList = new ArrayList();  public L3

C#编写的windows计算器-源代码

window|源代码 选择自 CSPRO 的 Blog using System;using System.Drawing;using System.Windows;using System.Windows.Forms;using System.Collections;using System.ComponentModel;using System.Data; namespace comput{    /// <summary>    /// 这是一个计算器的简单实现.    /// <

续实例解析SOCKET编程模型之异步通信篇(上)

编程|异步 .NET 框架的 Socket 类实际上是 Winsock32 API 提供的套接字服务的托管代码版本.其中Socket 类为网络通信提供了一套丰富的方法和属性,大多数情况下,Socket 类方法只是将数据封送到它们的本机Win32 副本中并处理任何必要的安全检查.Socket 类允许使用 ProtocolType 枚举中所列出的任何一种协议执行异步和同步数据传输.Socket 类遵循异步方法的 .NET Framework 命名模式:例如,同步 Receive 方法对应于异步 Be

续实例解析SOCKET编程模型之异步通信篇(下)

编程|异步 异步客户端套接字在等待网络操作完成时不挂起应用程序.相反,它使用标准 .NET Framework 异步编程模型在一个线程上处理网络连接,而应用程序继续在原始线程上运行.异步套接字适用于大量使用网络或不能等待网络操作完成才能继续的应用程序. Socket 类遵循异步方法的 .NET Framework 命名模式:例如,同步 Receive 方法对应异步 BeginReceive 和 EndReceive 方法. 异步操作要求回调方法返回操作结果.如果应用程序不需要知道结果,则不需要任