Time of Update: 2016-10-18
標籤: /// <summary> /// 列印的按鈕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) {
Time of Update: 2016-10-18
標籤:C#中欄位可以是公有或私人的,可以隨意的改變欄位的值,但是當需要限定欄位的取值範圍或者設定欄位唯讀或唯寫,單靠欄位是沒辦法完成的,這時就引入了屬性,可以通過屬性的get和set設定欄位的讀取許可權,get模組負責屬性的讀取,set模組負責屬性的寫入例:通過set限制欄位的取值 public class Person { private int _age;//欄位 public int Age//屬性 {
Time of Update: 2016-10-18
標籤:static List<int> Given50RandomNumbers() { List<int> intList = new List<int>(); for(int i=1;i<=50;i++) { intList.Add(i); }
Time of Update: 2016-10-18
標籤:public Dictionary<char,int> GetStrSameAs(string str){ //將字串轉換成一個字元數組. char[] charArray=str.ToCharArray(); //定義一個字典用,其中的鍵key作為取出的字元,值value作為對應字元的個數. Dictionary<char,int> dic=new Dictionary<char,int>();for(int
Time of Update: 2016-10-17
標籤:c# 二維碼 qrcode
Time of Update: 2016-10-17
標籤:原文地址:http://www.cnblogs.com/xcsn/p/4514759.html引用BarcodeLib.dll(百度雲中有)產生條形 protected void Button2_Click(object sender, EventArgs e)//點擊button2,產生條碼。 { System.Drawing.Image image; int width = 148, height = 55;
Time of Update: 2016-10-17
標籤:1、問題描述 最近在寫C#下AE的開發,在迴圈擷取資料並修改時碰到了兩個問題“超出系統資源”和“超出開啟遊標最大數”;在網上看了一些資料,發現都是說在迴圈中沒有釋放已經使用過的對象,但是在迴圈中實際上是有為com對象賦值為null的,但是還是沒法解決。後來想著將對象賦值為null和marshal是不是效果不一樣,就特意寫了一個簡單的迴圈來測試,代碼如下(初級代碼,比較亂,請輕噴): 1 public void Test_釋放遊標方式() 2 { 3
Time of Update: 2016-10-17
標籤:1.索引器方法結構大致為<modifier><return type> this [argument list],它可以在介面中定義: 在為介面聲明索引器的時候,記住聲明只是表示索引器的存在。你只需要提供恰當的訪問函數即可,不必包括範圍修飾符。以下代碼把索引器聲明為介面IImplementMe的一部分:interface IImplementMe { string this[int index] { get;
Time of Update: 2016-10-17
標籤:二維碼 項目中需要產生二維碼,方法比較多,可以採用JS外掛程式,也可以採用第三方外掛程式後台產生二維碼,在後台方法中可以採用QRCode或者GmaQrCode,現在介紹一種C#在後台產生二維碼的方法: /// <summary> /
Time of Update: 2016-10-17
標籤:首先定義比較類 繼承自IComparer<Racer> 1 public class RacerComparer : IComparer<Racer> 2 { 3 public enum CompareType 4 { 5 FirstName, LastName, Country, Wins 6 } 7 private CompareType compareType; 8
Time of Update: 2016-10-17
標籤://擷取當前進程的完整路徑,包含檔案名稱(進程名)。string str = this.GetType().Assembly.Location;result: X:\xxx\xxx\xxx.exe (.exe檔案所在的目錄+.exe檔案名稱)//擷取新的 Process 組件並將其與當前活動的進程關聯的主模組的完整路徑,包含檔案名稱(進程名)。string str =
Time of Update: 2016-10-17
標籤:預存程序簡介 簡單的說,預存程序是由一些SQL語句和控制語句組成的被封裝起來的過程,它駐留在資料庫中,可以被客戶應用程式調用,也可以從另一個過程或觸發器調用。它的參數可以被傳遞和返回。與應用程式中的函數過程類似,預存程序可以通過名字來調用,而且它們同樣有輸入參數和輸出參數。 根據傳回值類型的不同,我們可以將預存程序分為三類:返回記錄集的預存程序,
Time of Update: 2016-10-17
標籤:格式1:沒有參數,沒有傳回值 (無參無返)添加函數:/// <summary>/// 累加求和的方法,沒有參數,沒有傳回值/// </summary>public void LeiJia(){//累加求和Console.Write("請輸入一個正整數:");int a = int.Parse(Console.ReadLine());int sum = 0;for (int i = 1; i <= a; i++){sum +=
Time of Update: 2016-10-17
標籤:Asp.net DataTable添加列和行的方法方法一:DataTable tblDatas = new DataTable("Datas");DataColumn dc = null;dc = tblDatas.Columns.Add("ID", Type.GetType("System.Int32"));dc.AutoIncrement = true;//自動增加dc.AutoIncrementSeed = 1;//起始為1dc.AutoIncrementStep =
Time of Update: 2016-10-17
標籤:1.using指令using+命名空間,這種方法基本學習過C#的都用過,好處在於,寫代碼的時候不需要指定詳細的命名空間using System.Windows.Media; using System.Windows.Media.Imaging;2.using語句是用來簡化資源釋放的,在一定的範圍內有效,除了這個範圍時,自動調用IDisposable釋放掉,當然並不是所有的類都適用,只有實現了IDisposable介面的類才可以使用 using (SqlConnection
Time of Update: 2016-10-17
標籤:1 代碼 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 using System.Xml.Linq; 7 8 namespace ConsoleApplication8 9 {10 class Program11 {12 static void
Time of Update: 2016-10-17
標籤:1 代碼 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 6 using System.Xml.Linq; 7 8 namespace ConsoleApplication8 9 {10 11 class Program12 {13 static
Time of Update: 2016-10-17
標籤:1 xml檔案 1 <?xml version="1.0" encoding="utf-8" ?> 2 <cultures> 3 <daojia> 4 <book> 5 <name> 道德經</name> 6 <author>老子</author> 7 </book> 8
Time of Update: 2016-10-17
標籤:1 xml檔案 1 <?xml version="1.0" encoding="utf-8" ?> 2 <cultures> 3 4 <daojia> 5 <book> 6 <name> 道德經</name> 7 <author>老子</author> 8 </book> 9
Time of Update: 2016-10-17
標籤:1 xml檔案內容 1 <?xml version="1.0" encoding="utf-8" ?> 2 <cultures> 3 4 <daojia> 5 <book> 6 <name> 道德經</name> 7 <author>老子</author> 8 </book> 9