Time of Update: 2016-09-01
標籤: ORM架構使用dapper,dapper不僅能操作sqlserver,也能操作access,下面為基本代碼:OleDbConnection strConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "db.mdb" + ";Persist Security Info=False");
Time of Update: 2016-09-01
標籤:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Kernel.SimpleLibrary{ public class Person { private string name; public Person(){ } public
Time of Update: 2016-09-01
標籤:最近公司需要實現一個基於copydata處理序間通訊的功能。原來一直沒有接觸過Windows的進程通訊,這次正好可以學習一下。程式是基於Winform的,下面直接上代碼。公用類:public class ImportFromDLL { public const int WM_COPYDATA = 0x004A; //啟用Unmanaged 程式碼
Time of Update: 2016-09-01
標籤:本文根據30分鐘LINQ教程學習作的筆記。1、Guid.Empty Guid 結構:表示通用唯一識別碼 (GUID)。Empty欄位:Guid 結構的唯讀執行個體,其值均為零。用來設定初始值。 2、序列化與還原序列化序列化:
Time of Update: 2016-09-01
標籤:1. await例如有一個靜態方法 m , 要在程式中非同步呼叫這個方法, 就在此方法前加關鍵字 await , 那麼當程式運行到這條語句時, 會立即返回包含這條語句的方法, 並非同步執行 m 方法,這樣ui線程就不會被佔用, 然後當 m 方法執行結束後會再次返回這條語句繼續往下執行.2. async包含 await 關鍵字的方法必須添加 async 修飾符, 此方法的傳回型別可以為 Task、 Task<TResult>或 void. 方法不能聲明任何 ref 或 out
Time of Update: 2016-09-01
標籤: 1. 設定備份全域路徑下的路由 目的,我們在網站中網域名稱後面輸入參數,可以跳轉到相應的controller,例如:www.innovsys.cn/dd。直後端直接跳轉到controller,擷取dd參數。 第一步,在RouteConfig檔案中,添加 routes.MapRoute( name: "M", url:
Time of Update: 2016-09-01
標籤:C# Lambda運算式Lambda運算式"Lambda運算式"是一個匿名函數,是一種高效的類似於函數式編程的運算式,Lambda簡化了開發中需要編寫的代碼量。它可以包含運算式和語 句,並且可用於建立委託或運算式分類樹類型,支援帶有可綁定到委託或運算式樹狀架構的輸入參數的內聯運算式。所有Lambda運算式都使用Lambda運算 符=>,該運算子讀作"goes to"。Lambda運算子的左邊是輸入參數(如果有),右邊是運算式或語句塊。Lambda運算式x => x * x讀作"
Time of Update: 2016-09-01
標籤:CompareTo(Object) 方法主要用於排序或按字母順序排列操作。如果方法調用的主要目的在於確定兩個字串是否相等(即,方法調用的目的在於測試傳回值是否為零),則不應使用此方法。若要確定兩個字串是否相等,請調用 Equals
Time of Update: 2016-09-01
標籤: 調用: ConcurrentQueue<string> proxyIpQueue = new ConcurrentQueue<string>(); Grab_ProxyIp(proxyIpQueue); 返回結果: 一下是擷取代理IP集合的方法: #region 生產IP 代理 對象
Time of Update: 2016-09-01
標籤:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 //// Printing the DataGridView Control// in response to a toolbar button press – the myprintsettings and mypagesettings objects are
Time of Update: 2016-09-01
標籤:這節課我們來學習方法中的參數傳遞,在物件導向二中,我曾說過,參數也屬於變數的一種,在c語言的學習時,同學們都學習過參數這個概念和用法,方法使用參數列表來傳遞變數的基本文法如下:returnType FunctionName(paraType1 paraName1,paraType2 paraName2,……){ Function
Time of Update: 2016-09-01
標籤:/// <summary>/// XML序列化為指定對象/// Author:taiyonghai/// Time:2016-08-22/// </summary>/// <typeparam name="T">物件類型</typeparam>/// <param name="xmlString">xml字串</param>/// <returns></returns>public
Time of Update: 2016-09-01
標籤:Server.MapPath 的使用方法用法:1.Server.MapPath ("/") 應用程式根目錄所在的位置 如 C:\Inetpub\wwwroot\2.Server.MapPath ("./") 表示所在頁面的目前的目錄註:等價於Server.MapPath ("") 返回 Server.MapPath ("")所在頁面的物理檔案路徑3.Server.MapPath ("../")表示上一級目錄4.Server.MapPath
Time of Update: 2016-09-01
標籤://擷取當前進程的完整路徑,包含檔案名稱(進程名)。string str = this.GetType().Assembly.Location;result: X:\xxx\xxx\xxx.exe (.exe檔案所在的目錄+.exe檔案名稱)//擷取新的 Process 組件並將其與當前活動的進程關聯的主模組的完整路徑,包含檔案名稱(進程名)。string str =
Time of Update: 2016-09-01
標籤:如我們所常知的那樣, Server.MapPath() 屬性可以擷取應用程式的根目錄Server.MapPath 的使用方法用法:1.Server.MapPath ("/") 應用程式根目錄所在的位置 如 C:\Inetpub\wwwroot\2.Server.MapPath ("./") 表示所在頁面的目前的目錄註:等價於Server.MapPath ("") 返回 Server.MapPath ("")所在頁面的物理檔案路徑3.Server.MapPath
Time of Update: 2016-09-01
標籤: 運算式樹狀架構是.NET 3.5之後引入的,它是一個強大靈活的工具(比如用在LINQ中構造動態查詢)。 先來看看Expression類的API介面:using System.Collections.ObjectModel; namespace System.Linq.Expressions{ // Summary: // Represents a strongly typed lambda
Time of Update: 2016-09-01
標籤:理解:1.確保只有一個執行個體 2.提供一個全域訪問點,大白話就是:不能在其他類new 出來;代碼:using System;namespace SingletonDemo{//角色類,單例模式class Player{//欄位public string name;public int hp;public int Mhp;public int level;//共有屬性//共有方法public void BeAttack(){hp -=
Time of Update: 2016-08-31
標籤: 要說寫這個功能呢也是因為工作需要,白天呢上班寫個Web頁面需要ajax請求後台並將資料以Json格式傳會前端,由於公司特殊性吧,不能連外網(很苦比)。所以只有等到晚上回家上網邊查邊寫! public class DataToJson { private static System.Web.Script.Serialization.JavaScriptSerializer ser = new System.Web.
Time of Update: 2016-09-02
標籤:一、(int)變數名[強制類型轉換]: 該轉換方式主要用於數字類型轉換,從int類型到long,float,double,decimal類型,可以使用隱式轉換,但是從long類型到int類型就需要使用顯式轉換,也就是該資料類型轉換方式,否則會產生編譯錯誤。 該方式對於浮點數會做無條件捨去,失去精確度。當然,該方式也可以進行object到int得轉換,但是,object的值要賦予int類型的值,否則會產生編譯錯誤,而且object為null時也會出錯。最後切忌的一點,千萬
Time of Update: 2016-09-01
標籤:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Kernel.Interface{ public interface IObjcet { void Put(); void Put(string plus); }}using System;using