2011-8-15

来源:互联网 发布:老公丁丁弯的快感知乎 编辑:程序博客网 时间:2024/05/01 10:20
StringBuilder 类:  表示可变字符字符串。此类不能被继承。


接口,对象,初始化时,赋值 null 


MD5   
将一个字符串转换为32位字符串;(32位16进制数字字符串)
不可逆算法;
添加引用:system.web
引入命名空间:using System.Web.Security;
MD5加密:string md5str= FormsAuthentication.HashPasswordForStoringInConfigFile(strName,"MD5");



常见项目术语:
什么是呼叫中心(Call Center) 。公司客服系统,接警平台,医院接诊系统。
CRM(客户关系管理, Customer Relationship Management )。
OA(Office Automation);MIS(Management Information System,什么都是MIS系统);ERP(Enterprise Resources Planning)。



输出excel文件
1.OLEAutomation:程序启动一个Excel进程,然后和Excel进程进行通讯来进行Excel的操作。优点:强大,能够使用Excel的所有功能,要求装Excel,微软最推荐这种用法,因为可以促进Excel的销量。会启动Excel进程,不适合于服务器(比如Asp.Net网站,安全性、效率)。参考资料http://topic.csdn.net/t/20031204/09/2525334.html。
 
2.(*)把Excel当成数据库,使用Microsoft.Jet.OleDb访问访问Excel ,参考资料 http://tieba.baidu.com/f?kz=331569890 只适合于完全二维结构,功能最弱,很少用。不用装Excel。

3.(*) OpenXML,微软提供的读写Excel的技术,优点和NPOI差不多,不过只能处理xlsx格式文件。docx、pptx。
4.NPOI、MyXls等,NPOI能够分析Excel文件的格式,能够进行常用Excel操作,不依赖于Excel,节省资源,没有安全性、性能的问题,在ASP.net中用最合适。只能处理xls格式文件、不能处理xlsx这样的新版本Excel文件格式。处理xlsx还要用OpenXML。

Stream  
using(Stream file=File.OpenRead(str)){}  //读取str文件,并存入二进制file中。
每次向文件流中写入数据时,并不是立刻将数据保存到文件流对应的硬盘文件,而是当文件流对象被关闭时或者显示的调用了流对象的Flush方法时,才次性将流对象缓存中


Queue 类
表示对象的先进先出集合。
ArrayList .GetRange 方法
返回 ArrayList,它表示源 ArrayList 中元素的子集。
using System;
using System.Collections;
public class SamplesArrayList  {


  public static void Main()  {


 // Creates and initializes a new ArrayList.
 ArrayList myAL = new ArrayList();
 myAL.Add( "The" );
 myAL.Add( "quick" );
 myAL.Add( "brown" );
 myAL.Add( "fox" );
 myAL.Add( "jumped" );
 myAL.Add( "over" );
 myAL.Add( "the" );
 myAL.Add( "lazy" );
 myAL.Add( "dog" );


 // Creates and initializes the source ICollection.
 Queue mySourceList = new Queue();
 mySourceList.Enqueue( "big" );
 mySourceList.Enqueue( "gray" );
 mySourceList.Enqueue( "wolf" );


 // Displays the values of five elements starting at index 0.
 ArrayList mySubAL = myAL.GetRange( 0, 5 );
 Console.WriteLine( "Index 0 through 4 contains:" );
 PrintValues( mySubAL, '\t' );


 // Replaces the values of five elements starting at index 1 with the values in the ICollection.
 myAL.SetRange( 1, mySourceList );


 // Displays the values of five elements starting at index 0.
 mySubAL = myAL.GetRange( 0, 5 );
 Console.WriteLine( "Index 0 through 4 now contains:" );
 PrintValues( mySubAL, '\t' );


  }


  public static void PrintValues( IEnumerable myList, char mySeparator )  {
 foreach ( Object obj in myList )
Console.Write( "{0}{1}", mySeparator, obj );
 Console.WriteLine();
  }


}
/* 
This code produces the following output.


Index 0 through 4 contains:
The     quick   brown   fox     jumped
Index 0 through 4 now contains:
The     big     gray    wolf    jumped
*/ 


邮件发送:
导入引用空间:  using system.net;
using system.net.mail;
SMTP:发送邮件协议,端口25;POP3:收邮件协议,端口110。 
1、发送普通文本邮件 
            MailMessage mailMsg = new MailMessage();//两个类,别混了 引入System.Web这个Assembly
            mailMsg.From = new MailAddress("admin@rupeng.com", "新广源集团客服中心");//源邮件地址 
            mailMsg.To.Add(new MailAddress("yzk@rupeng.com", "杨中科"));//目的邮件地址。可以有多个收件人
            mailMsg.Subject = "关于.net培训班咨询事宜";//发送邮件的标题 
            mailMsg.Body = "附件中是资料,请查收!";//发送邮件的内容 
           SmtpClient client = new SmtpClient("127.0.0.1");
            client.Credentials = new NetworkCredential("admin", "123456");
            client.Send(mailMsg);
        2、发送HTML格式邮件:
          AlternateView htmlBody =AlternateView.CreateAlternateViewFromString(htmlBodyContent, null, "text/html");
            mailMsg.AlternateViews.Add(htmlBody);