頁面對用戶端做304緩衝

頁面對用戶端做304緩衝核心代碼1 HttpRuntimeSection runtime = new System.Web.Configuration.HttpRuntimeSection();2 runtime.EnableKernelOutputCache = false;3 Response.Cache.SetLastModified(DateTime.Now);4 Response.Cache.SetExpires(DateTime.Now.AddSeconds(5));5

第7天:重新命名

其實這一條很好理解,就是對類名,變數名,參數名,方法名亂寫,這樣很容易搞錯比方說起一些名字叫a1,a2就比較難以理解 應該起一些更加具有描述性,更助於理解的名字 範例程式碼:舊代碼Code public class Person { public string FN { get; set; } public decimal ClcHrlyPR() { // code to calculate hourly payrate

正則匹配替換樣本

一直對正則匹配替換稀裡糊塗的,這次做了一個測試,把問題搞明白記錄一下        string regexString = "(匹配)";         string regexContent = "做一個測試,匹配三次,匹配的是'匹配'兩個字本身'";         public void Main()         {             Regex regex = new Regex(regexString, RegexOptions.Singleline);         

反射的補充

反射的補充載入程式集,擷取各種item代碼很明確,直接上了using System;using System.Collections.Generic;using System.Text;using System.Reflection;namespace FanShe{     public class Test     {         Assembly myAssembly=null;         public Test()         {             //第一種方法:

第8天:用委託代替繼承

之前有說過盡量少用繼承 這個方法就是講這個的 舊的代碼:  Code public class Sanitation { public string WashHands() { return "Cleaned!"; } } public class Child : Sanitation { } 重構後的代碼:  Code public class Sanitation {

第10天:提取方法

這一條重構的建議是盡量提取方法,使得代碼更加清晰明了舊的代碼:Codepublic class Receipt{private IList<decimal> Discounts { get; set; }private IList<decimal> ItemTotals { get; set; }public decimal CalculateGrandTotal(){decimal subTotal = 0m;foreach (decimal itemTotal in

List和DataTable的Limit

因為經常要對List<T>或者DataTable進行分組,所以就封裝了一下 其實也沒有什麼,主要是DataTable要用ImportRow方法     public class OtherManager<T>     {         /// <summary>         /// 對List進行分區         /// </summary>         /// <param name="source">要分區的List&

得到頁面中的所有連結函數

這個函數是以前做搜尋引擎的時候遇見過的, x1代表的是當前文檔的http地址,而x2代表的是頁面中的連結地址 CodeCode highlighting produced by Actipro CodeHighlighter

DataTable轉Entity(Emit版)

Emit就是快啊,我有做測試30000條資料,直接發射的話7秒多,Emit1.2秒左右先記下來,有空了研究public static class NewClas     {                public static List<T> ToList<T>(DataTable dt)         {             List<T> list = new List<T>();             if (dt ==

Excel宏不要彈出來

Set ExcelApp = CreateObject("Excel.Application") Set ExcelSheet = createobject("Excel.Sheet") ExcelSheet.ActiveSheet.Cells(1,1).Value = "My Vbscript" ExcelSheet.SaveAs("C:\111.XLS") ExcelSheet.Application.Quit() 將這些代碼複製到記事本中,然後另存新檔所有檔案,檔案名稱叫1.vbs

Url解碼,相容utf-8和gb2312

自己做個網站,發現百度的蜘蛛和Google的蜘蛛對Url的編碼解碼方式不一致,給我造成了很大的困惑啊,做了一個函數,統一由此解碼,世界清靜了順便宣傳一下網站地址 接龍大全         protected void Page_Load(object sender, EventArgs e)         {             Response.Write(UrlDecode("xxx"));         }         /// <summary>         /

資料庫之間各種格式匯入匯出

SQL Server 阻止了對組件 'xp_cmdshell' 的 過程'sys.xp_cmdshell' 的訪問,因為此組件已作為此伺服器安全配置的一部分而被關閉。系統管理員可以通過使用 sp_configure 啟用 'xp_cmdshell'。有關啟用 'xp_cmdshell' 的詳細資料,請參閱 SQL Server 聯機叢書中的 "介面區配置器"。用下面一句話就可以瞭解決了。 EXEC sp_configure 'show advanced options',

用SOS.dll來偵錯工具

此方法需要使用SOS.dll的一些方法,我們可以通過安裝微軟的Debugging Tools for windows來得到此dll。 :http://www.microsoft.com/whdc/devtools/debugging/installx86.mspx先在工程的屬性頁面,調試裡面勾選啟用非託管堆調試在適當的地方設定斷點 然後再即時視窗輸入“.load

第9天:抽取介面

這個重構方法其實就是說把類的介面抽取出來,參數傳遞的時候以介面而不是具體的類個人理解這就是面向介面的編程思想吧,有哪位達人知道的請告知一下 例子很簡單,舊代碼:Codepublic class ClassRegistration{public void Create(){// create registration code}public void Transfer(){// class transfer code}public decimal Total { get; private set;

基礎知識之最大化,最小化,系統托盤表徵圖,右鍵菜單,提示氣球,關閉

基礎知識之最大化,最小化,系統托盤表徵圖,右鍵菜單,提示氣球琢磨了一下C/S軟體,打算做一個,先記錄一下基礎的東西1.最小化 WindowState = FormWindowState.Minimized; //最小化時隱藏表單 this.Visible=false;2.最大化 WindowState == FormWindowState.Maximized;3.還原為正常 WindowState == FormWindowState.Normal;4.系統托盤表徵圖

帶參數和不帶參數的多線程

好久沒有用多線程了,好多都忘記了記一下帶object參數的ParameterizedThreadStart:public void Start(){     for (int index = 0; index < 10; index++)     {         #region -- 準備參數 --         List<int> list = new List<int>();         for (int param = index; param

第11天:用策略模式代替switch

今天的重構很有意思,舊的代碼是根據參數State來調用三個不同的方法,擷取三個地方的裝運量代碼如下:Code public class ClientCode { public decimal CalculateShipping() { ShippingInfo shippingInfo = new ShippingInfo(); return

第1天:集合封裝

對集合進行封裝,只把需要的介面暴露給外部使用者,例如AddStudent,RemoveStudent以及屬性Count而不是把整個集合暴露出來讓外部使用者去操作  Codepublic class MyCollection{public MyCollection(){list = new List<StudentInfo>();}private List<StudentInfo> list = null;public void

第2天:移動方法

我覺得這個其實沒什麼就是說把某些方法移動到常用的類裡面去這個應該在我們寫程式的時候潛意識裡面就會做到的例子如下 錯誤的代碼: Code public class BankAccount { public BankAccount(int accountAge, int creditScore, AccountInterest accountInterest) { AccountAge = accountAge;

XP下修改IIS串連數

做點東西,本地的iis很容易出現串連數過多的問題查了下,xp下預設iis串連數只有10,可以更改iis數記錄一下首先,你需要到下面的地址下載MetaEdit,最新版本是2.2,地址 http://download.microsoft.com/download/iis50/Utility/5.0/NT45/EN-US/MtaEdt22.exe

總頁數: 61357 1 .... 12239 12240 12241 12242 12243 .... 61357 Go to: 前往

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.