Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

asp.netÃæÊԴ𰸲¹³ä3 .netµÄÀ¬»ø»ØÊÕ»úÖÆ

.net À¬»ø»ØÊÕ»úÖÆ ¡¾×ªÌû¡¿
2009-02-13 17:44
netÄÚ´æ»ØÊÕÓëDispose﹐Close﹐Finalize·½·¨
Ò». netµÄ¶ÔÏóʹÓÃÒ»°ã·ÖΪÈýÖÖÇé¿ö﹕
1.´´½¨¶ÔÏó
2.ʹÓöÔÏó
3.ÊͷŶÔÏó
¶þ.´´½¨¶ÔÏó
1.´´½¨¶ÔÏóʵ¼Ê·ÖΪÁ½¸ö²½Öè﹕±äÁ¿ÀàÐÍÐû¸æºÍ³õʼ»¯¶ÔÏó
2.±äÁ¿ÀàÐÍÐû¸æ(declare),Èç﹕
FileStream fs
ÕâÐдúÂë»áÔÚµ±Ç°µÄ±äÁ¿×÷ÓÃÓò¿Õ¼ä(Õ»»ò¶Ñ)ÀィÁ¢Ò»¸ö½Ð×öfsµÄ±äÁ¿﹐ÖÁÉÙËĸö×Ö½Ú°É(ÒòΪҪ´æÒ»¸ö¶ÔÏóµÄµØÖ·)
3.³õʼ»¯¶ÔÏó
¶ÔÏóÔÚʹÓÃ(µ÷ÓÃÆä·½·¨»òÊôÐÔ)Ç°﹐±ØÐë½øÐгõʼ»¯¡£
Èç﹕
fs = new FileStream(@"C:\test.txt",FileMode.OpenOrCreate);
ÕâÐдúÂë»á·Ö³É3¸ö²½Öè﹕
a.ÔÚÍйܶÑÖзÖÅäÒ»¿éÄÚ´æ﹐Æä´óСµÈÓÚFileStreamÖÐËùÓÐ×Ö¶Î(µ±È»²»°üÀ¨¾²Ì¬µÄ)µÄÄÚ´æ×ܺͼÓÉÏMSÈÏΪÐèÒªµÄÆäËü¶«¶«¡£
b.³õʼ»¯¶ÔÏóµÄ×Ö¶Î(ÖµÀàÐ͵İÑÆäλȫ²¿³õʼ»¯³É0,¶ÔÏó³õʼ»¯Îªnull﹐µ±È»stringÊÇÒ»¸öÀýÍâ﹐Ëü±»³õʼ»¯³É¿Õ×Ö·û´®)
c.µ÷ÓÃFileStreamÏàÓ¦µÄ¹¹ÔìÆ÷﹐ÕâÀï»á³õʼ»¯Ò»¸ö·ÇÍйÜ×ÊÔ´(Îļþ)µÄ˽ÓÐ×ֶΡ£
Èý.ʹÓöÔÏó
ʹÓöÔÏó¾Íûʲô½²µÄ﹐¾ÍÊǵ÷ÓöÔÏóµÄ·½·¨(»òÊôÐÔµÈ)À´Íê³Éij¸ö¹¦Äܵ±È»ÎªÁËÊͷŶÔÏó¶øµ÷Óõķ½·¨Æä·¶³ëÓ¦²»ÊôÓÚ´ËÀàÖÐ(ÏÖÔÚÌáµ½µÄFinalizeµÈ)
ËÄ.ÊͷŶÔÏó
1.ÊͷŶÔÏóÒ²¾ÍÊÇ˵Õâ¸ö¶ÔÏóÎÒÒѾ­²»ÐèÒªÁË﹐ÏÖÔÚÎÒÒª°ÑÆäÊÍ·Å﹐ÒÔ±ã°ÑÆäÔÚ¶ÑÉÏËùÕ¼ÓõÄÄÚ´æ¿Õ¼ä¸øÊÕ»ØÀ´(µ±È»±äÁ¿ÃûµÄÄÚ´æ¿Õ¼ä¾Í²»ÐèÒª¹ÜÁË﹐ÒòΪËü»áËæÆä×÷ÓÃÓò×Ô¶¯Ïûʧ)
2. .net×Ô¶¯½øÐÐÄÚ´æ¹ÜÀí﹐Ò²¾ÍÊÇ˵µ±ËüÅжÏÒ»¸ö¶ÔÏóûÓÐÓÃÁË(µ±È»ÓÐ×Ô¼ºµÄËã·¨)﹐Ëü¾Í»á½«ÆäÄÚ´æ¸ø×Ô¶¯ÊÕ»ØÀ´﹐µ«ÊÇÆäÊջصÄʱ¼äÒ»°ã²»È·¶¨(µ±.netÈÏΪÄÚ´æ½ôÕÅʱ﹐Ëü¾Í»á¿ªÊ¼)
BTW:ÆäʵÎÒÃǾÍÊÇÏë×Ô¼ºÊջضÔÏóµÄÄÚ´æÒ²²»¿ÉÄÜ﹐ÒòΪMSûÓÐÌṩ;¾¶(GC.CollectÒ²ÊÇÆô¶¯.netµÄÄÚ´æÊÕ¼¯¹¦ÄÜ)
Îå.µÚÒ»¸ö½áÂÛ
ÔÚnetÖÐʹÓöÔÏóºÜ¼òµ¥﹐´´½¨¶ÔÏóÖ®ºóÖ±½ÓʹÓþͿÉÒÔÁË﹐²»ÓÃÁËÒ²²»ÒªÈ¥¹ÜËü﹐À¬»øÊÕ¼¯Æ÷»á°ïÄã°ÑÄÚ´æÒª»ØÀ´µÄ¡£
Áù.ÀýÍâ
µ±¶ÔÏóµÄ³ÉÔ±ÒýÓÃÁËÒ»¸ö·ÇÍйÜ×ÊԴʱ(²»ÔÚÍйܶÑÉÏ·ÖÅäµÄÄÚ´æ»ò×ÊÔ´﹐ÏñÎļþ﹐Êý¾Ý¿âÁ¬½ÓµÈµÈ)﹐ÏÂÃæÒÔÒ»¸öÀý×ÓÀ´ËµÃ÷﹕
System.IO.FileStreamÀà±ð﹐ÕâÊÇ.net»ù±¾Àà¿âÌṩµÄÒ»¸ö·ÇÍйÜ×ÊÔ´(Îļþ)·â×°¶ÔÏó(ÓÃReflector¹¤¾ß·´±àÒëmscorlib.dll¿É¼ûÆä´úÂë)
1.FileStreamºÁÎÞÒÉÎÊ·â×°ÁË


Ïà¹ØÎĵµ£º

ASP.NET³ÌÐòÖг£ÓôúÂë»ã×Ü

 1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º //´«ËͲÎÊý£º
response.write("£¼script£¾window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="++"’)£¼/script£¾")
¡¡¡¡//½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QueryString("id1");

2.Ϊ°´Å¥Ìí¼Ó¶Ô»°¿ò
Button1 ......

asp.netʹÓþ«ÁéÄ«ÁÖÌáʾÕÒ²»µ½Ö¸¶¨Ä£¿é

´°Ìå´úÂë:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using AgentObjects;
using SpeechLib;
using System.Web;
using System.Threading;
using System.Text.RegularExpressio ......

ASP.NETÖеÄÊý¾Ý¿â²Ù×÷Ààsqlhelper¼°·½·¨Ê¹ÓÃÖ¸ÄÏ

ÒªÔÚVS2005ÖÐʹÓÃsqlhelperÀà,±ØÐë°ÑMicrosoft.ApplicationBlocks.Data.dllÒýÓõ½ÏîÄ¿ÖÐ.
1.ͨ¹ý´æ´¢¹ý³Ì²éѯµÄ·½·¨SqlHelper.ExecuteDataset(Êý¾Ý¿âÁ¬½Ó×Ö·û, ´æ´¢¹ý³Ì×Ö·û, ²ÎÊýÊý×é);
2.ͨ¹ý×Ö·û´®²éѯµÄ·½·¨SqlHelper.ExecuteDataset(Êý¾Ý¿âÁ¬½Ó×Ö·û, CommandType.Text , ²éѯ×Ö·û´®,²ÎÊýÊý×é);
3.ͨ¹ý´æ´¢¹ý³Ì²åÈëµ ......

ASP.net:Literal¿Ø¼þÓ÷¨

¸Õ¿ªÊ¼Ñ§.NETµÄÅóÓÑ¿ÉÄܲ»Çå³þLiteralºÍLabelµ½µ×ÓÐʲôÇø±ð,ÆäʵËüÃÇÒ²Ö»ÓÐÒ»¸öÇø±ð,¾ÍÊÇÔÚת»»³É¿Í»§¶ËHtml´úÂëºó,Label¾Í³ÉÁË<span></span>,¶øLiteralÔòÊÇʲô±ê¼Ç¶¼²»´ø,ÏÂÃæ½øÈëÕýÌâ:
       ×òÌì×öÒ»¸öÍøÕ¾µÄÊÓƵÐÂÎŹÜÀí,Ê×ÏÈÎÒÒªÔÚÒ³ÃæÀïÌí¼ÓÒ»¸ö²¥·ÅÆ÷,ÈçÏÂ:
1<OB ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ