JasonHo

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年8月24日

摘要: 泛型 一、什么是泛型? 通过泛型可以定义类型安全类,而不会损害类型安全、性能或工作效率 二、实例化泛型 1、可以使用任何类型来声明和实例化 2、申明和实例话都必须用一个特定的类型来代替一般类型T 3、例子: //原来写法 Public class Stack { object[] m_Items; public void Push(object item) {...} public object Pop() {...} } Stack stack = new Stack(); stack.Push(1); int number = (... 阅读全文
posted @ 2012-08-24 10:59 JasonHo 阅读(7202) 评论(0) 推荐(0) 编辑

2012年8月16日

摘要: View Code 1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4 using System.Net; 5 using System.IO; 6 using System.Globalization; 7 using System.Text.RegularExpressions; 8 namespace WebBaseLib 9 { 10 /// <summary> 11 /... 阅读全文
posted @ 2012-08-16 14:26 JasonHo 阅读(673) 评论(0) 推荐(0) 编辑

2012年7月12日

摘要: /* 需要添加以下命名空间: using System.IO; using System.Security.AccessControl; */ string sPath = Server.MapPath(文件夹名称字符串); Directory.CreateDirectory(sPath); addpathPower(sPath, "ASPNET", "FullControl"); ////////////////////////////////////////////////// publicvoid addpathPower(string pathn 阅读全文
posted @ 2012-07-12 18:54 JasonHo 阅读(628) 评论(0) 推荐(0) 编辑

2012年2月21日

摘要: 编辑器加载中...//Image写入XMLusing System.IO;using System.Runtime.Serialization.Formatters.Soap;string MyFile = @"D:\数据处理\image.xml";string imageFile = @"G:\zengwei.jpg";Stream MyStream;SoapFormatter MyFormatter =new SoapFormatter();void Mathod1(){ try { MyStream = new FileStream( My... 阅读全文
posted @ 2012-02-21 14:11 JasonHo 阅读(1259) 评论(0) 推荐(0) 编辑

2011年11月18日

摘要: 有关C#接口和抽象类的使用,MSDN的建议:如果预计要创建组件的多个版本,则创建抽象类。抽象类提供简单易行的方法来控制组件版本。通过更新基类,所有继承类都随更改自动更新。另一方面,接口一旦创建就不能更改。如果需要接口的新版本,必须创建一个全新的接口。如果创建的功能将在大范围的全异对象间使用,则使用接口。抽象类应主要用于关系密切的对象,而接口最适合为不相关的类提供通用功能。如果要设计小而简练的功能块,则使用接口。如果要设计大的功能单元,则使用抽象类。如果要在组件的所有实现间提供通用的已实现功能,则使用抽象类。抽象类允许部分实现类,而接口不包含任何成员的实现。 阅读全文
posted @ 2011-11-18 09:52 JasonHo 阅读(247) 评论(0) 推荐(0) 编辑