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 ==
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
這個重構方法其實就是說把類的介面抽取出來,參數傳遞的時候以介面而不是具體的類個人理解這就是面向介面的編程思想吧,有哪位達人知道的請告知一下 例子很簡單,舊代碼:Codepublic class ClassRegistration{public void Create(){// create registration code}public void Transfer(){// class transfer code}public decimal Total { get; private set;
好久沒有用多線程了,好多都忘記了記一下帶object參數的ParameterizedThreadStart:public void Start(){ for (int index = 0; index < 10; index++) { #region -- 準備參數 -- List<int> list = new List<int>(); for (int param = index; param
昨天看了一下多線程,以後還是將一些代碼發到部落格上比較好。現在電腦上以前寫的代碼都沒有開啟看一眼的慾望了。還是發到部落格好,可以隨時看看,而且也能協助一下別人。呵呵 最主要就是學習了一下CreateThread函數以及這次徹底看了一下LPVOID類型,原來這個類型指的是null 指標啊,以前很汗啊。下面就上代碼:// MutiThread.cpp : Defines the entry point for the console application.///*
今天的重構很有意思,舊的代碼是根據參數State來調用三個不同的方法,擷取三個地方的裝運量代碼如下:Code public class ClientCode { public decimal CalculateShipping() { ShippingInfo shippingInfo = new ShippingInfo(); return
對集合進行封裝,只把需要的介面暴露給外部使用者,例如AddStudent,RemoveStudent以及屬性Count而不是把整個集合暴露出來讓外部使用者去操作 Codepublic class MyCollection{public MyCollection(){list = new List<StudentInfo>();}private List<StudentInfo> list = null;public void
我覺得這個其實沒什麼就是說把某些方法移動到常用的類裡面去這個應該在我們寫程式的時候潛意識裡面就會做到的例子如下 錯誤的代碼: Code public class BankAccount { public BankAccount(int accountAge, int creditScore, AccountInterest accountInterest) { AccountAge = accountAge;