1. 程式人生 > >Tvm Software Technology

Tvm Software Technology

1)避免使用ArrayList,因為物件要轉化為System.Object加入ArrayList,取出時又要轉化為想要的型別,設計到大量的裝箱拆箱過程,推薦使用自定義集合取代ArrayList,.net還在System.Collection.Specialized名稱空間下為string提供了一個強型別的集合類StringCollection

2)用Hashtable 取代其他字典型別,如:StringDictionary, NameValueCollection, HybridCollection。

3)經常為字串宣告常量來封裝他們
   //避免
   MyObject obj = new
MyObject();
   obj.Status =

"ACTIVE";
   //推薦
    
   const
string C_STATUS = "ACTIVE"
;
   MyObject obj =
new
MyObject();
   obj.Status = C_STATUS;

4使用String.Compare取代將兩個字串轉化為uppercase或lowercase再來比較他們
   conststring C_VALUE = "COMPARE"
;
   if (String.Compare(sVariable, C_VALUE, true
) == 0)
   {
         Console.Write("SAME"
);
   }

5避免使用+操作符來連線字串,而使用StringBuilder來連線

   //避免
   String
sXML = "<parent>"
;
   sXML +=
"<child>"
;
   sXML +=
"Data"
;
   sXML += "</child>"
;
   sXML +=
"</parent>";
              //推薦
   StringBuilder sbXML = new
StringBuilder();
   sbXML.Append(
"<parent>"
);
   sbXML.Append(
"<child>"
);
   sbXML.Append(
"Data"
);
   sbXML.Append(
"</child>"
);
   sbXML.Append(
"</parent>");

6)對於只讀xml文件,用XPathDocument取代XMLDocumentt
   //避免
   XmlDocument xmld = new
XmlDocument();
   xmld.LoadXml(sXML);
   txtName.Text = xmld.SelectSingleNode(
"/packet/child"
).InnerText;
   //推薦
   XPathDocument xmldContext = new XPathDocument(new
StringReader(oContext.Value));
   XPathNavigator xnav = xmldContext.CreateNavigator();
   XPathNodeIterator xpNodeIter = xnav.Select(
"packet/child"
);
   iCount = xpNodeIter.Count;
   xpNodeIter = xnav.SelectDescendants(XPathNodeType.Element,
false
);
   while
(xpNodeIter.MoveNext())
   {
         sCurrValues += xpNodeIter.Current.Value+
"~"
;
   }

7)避免在迴圈體類宣告並初始化物件,而應該在迴圈體外宣告,在迴圈體類初始化!
   //避免
   for(int
i=0; i<10; i++)
   {
       SomeClass objSC =
new SomeClass();

   }
   //推薦
   SomeClass objSC = null
;
   for(int
i=0; i<10; i++)
   {
       objSC =
new
SomeClass();
   }

下面是專門針對Web程式效能的設計方針
1) Viewstate 會動態增加頁面體積,所以要小心的使用控制元件的Viewstate 屬性。
2) 儘可能使用ajax。
3) 使用server.tranfer取代response.redirect。
4) 儘可能使用repeater和datalist取代datagrid。
5) 儘量避免Throw來控制程式流程,因為Throw會消耗大量資源。
6) 避免過度使用異常處理程式塊,只在你無法控制的地方做異常處理。
7) 大量dataset很昂貴,儘量一次取得最多的資料,然後銷燬dataset
8) 使用快取
9) 使用合適的認證機制
10)使用Finally方法釋放資源
11)網站釋出後將Debug和trace設為false。
 

相關推薦

Tvm Software Technology

1)避免使用ArrayList,因為物件要轉化為System.Object加入ArrayList,取出時又要轉化為想要的型別,設計到大量的裝箱拆箱過程,推薦使用自定義集合取代ArrayList,.net還在System.Collection.Specialized名稱空間下為string提供了一個強型別的集

Data Analytics For B2B Software & Technology

B2B Software & Technology Driving prospects through the funnel starts with the right data. To turn leads into happy customers (and recurring revenue),

文獻:Technology-related Disasters:A Survey toward Disaster-resilient Software Defined Networks

利用 tro direct 其他 switch war 檢測 控制器 有一個 DISASTER的定義和影響(本文中) 定義範圍: 自然災害,比如洪水、地震等造成一定範圍類的節點故障; 惡意攻擊,DDOS攻擊或者電磁脈沖攻擊造成節點故障; 技術相關的問題,配置錯誤或者誤操作

information technology software

Microsoft has announced an experimental release of "Robot Operating System (ROS1)" for Windows as a next step in bringing features like Machine Learning (M

Ask HN: Buried by Technology and Software Complexity

In the past, technology like the horse drawn carriage was fairly simple in that one person could understand it all. Now we have massive things like aircraf

Cognitive Technology Software: Cogito

Effective data and information management is the foundation for competitive advantage for enterprises in any industry. To

Advanced computer technology and software turn species identification interactive: Important group of biocontrol wasps from Cent

Having recently studied a species group of these wasps in Central Europe, scientists Fabian Klimmek and Hannes Baur of the Natural History Museum Bern, Sw

贊一下TMS Software 和 AdvStringGrid

src email war 接口 設計 dex 函數 blog ont 非常久前給Support發Email問能不能在設計期給AdvStringGrid標題加個數字標識。每次我都是自己改代碼加上去。這次升級到新版本號,沒想到增加了這個功能: 功能雖小可是非常有用,非常

php項目報錯 Warning: session_start(): open(D:/software/wamp/wamp/tmpsess_msrjot7f32ciqb1p2hr4ahejg4, O_RDWR) f

sof nbsp 存儲 項目 software 文件 建立 sta tar 今天一個php項目報錯: Warning: session_start(): open(D:/software/wamp/wamp/tmp\sess_msrjot7f32ciqb1p2hr4ahe

Software Engineering——A PRACTITIONER'S APPROACH (english edition · eighth edition)

sts hose english lin curring orf reference spl sign ARCHITETUAL DESIGN Record at P261 Choosing the right architecture style can be tric

LXT技術平臺(Lenovo Trust Technology

用戶需求 lock blue 技術 系統 edi 體驗 lin display LXT技術平臺(L是Lenovo的縮寫,T是技術Technology,X代表多個應用方向),是聯想以用戶需求為導向,整合先進技術,為用戶提供最佳應用體驗的一體化解決方案。 中文:LXT

software architecture

ssi base for elements mini editing sed 介紹 team 12 what is a stakeholder.    11 what kind is UML?   UML is a seminotation way. 10 List not

software architecture slide 2

chan cti access term levels eas rar trade extern 34 33 what are cohension levels from bad to good?   coincidental   logical   temporal  

Maxmess-Software.On-Site.Survey.2014.1.4 1CD

手機 exida.exSILentia.2014.v2.4.0.25 1CD Maxmess-Software.On-Site.Photo.2010.1.9.1 1CD Maxmess-Software.On-Site.Survey.2014.1.4 1CD PowerSurfacing RE v2.4-4.

軟件集Software Collections

gcc scl 軟件集 一、SCL1、SCL是什麽SCL項目主頁:https://www.softwarecollections.org/ SCL(Software Collections)可以讓你在同一個操作系統上安裝和使用多個版本的軟件,而不會影響整個系統的安裝包。SCL為社區的以下需求而

Catalyst 2960 and 2960-S Software -Configuring VTP

-m data- tracking target cisc st2 ont track htm http://www.cisco.com/c/en/us/td/docs/switches/lan/catalyst2960/software/release/12-2_53

testNG java.net.SocketException: Software caused connection abort: socket write error

dex ges error pom.xml .so lai sun panel light 執行用例報錯,提示 java.net.SocketException: Software caused connection abort: socket write error

軟件定義網絡(Software Defined Network, SDN)

軟件定義網絡 sdn入門 sdn價值 sdn應用場景軟件定義網絡(Software Defined Network, SDN)在InfoWorld於2011年11月公布的將影響未來10年的十項新技術中排名第二。2012年7月,SDN代表廠商Nicira被VMware以12.6億美元收購,隨後Google宣布成

Learning to rank (software, datasets)

rdl n) gbrt comm eve ftw eva ext ros Datasets for ranking (LETOR datasets) MSLR-WEB10k and MSLR-WEB30k You’ll need much patien

更新 是 可用的 針對 安卓 軟件開發包和工具 Updates are available for android software development packages and tools

安卓 模擬器 軟件 ide software ava -m android 設置 作者:韓夢飛沙 Author:han_meng_fei_sha 郵箱:[email protected]/* */ E-mail: 313134555 @qq.com