Time of Update: 2015-11-27
標籤:
Time of Update: 2015-11-27
標籤:在項目開發中,使用SQL Server儲存資料,資料類型image可以儲存圖片。但是在儲存之前需要將圖片轉化為位元組的形式進行賦值。將圖片檔案轉換為位元組/// <summary> /// 將圖片檔案轉換為位元組 /// </summary> /// <param name=”picpath”>圖片路徑</param> /// <returns>位元組</returns>
Time of Update: 2015-11-27
標籤: 學習集合的一些知識。集合:泛型集合,非泛型集合;ArrayList,Hashtable,List<T>,Dictionary<k,v>等,還有一些集合的常用方法。 一:集合的介紹 1:集合的特點 泛型集合 using System.Collections.Generic 非泛型集合 using System.Collections
Time of Update: 2015-11-27
標籤:using System.Drawing;using System.Windows.Forms; namespace WindowsFormsApplication1{ class ScreenCapture { private Bitmap _screenshot = null; /// <summary> /// 截取全屏 /// </summary> ///
Time of Update: 2015-11-27
標籤:public static void BulkCopyToDB(DataTable dt, string conn, string tableName, out string msg) { msg = ""; if (dt.Rows.Count > 0) { using (SqlConnection connection = new SqlConnection(conn))
Time of Update: 2015-11-26
標籤:屬性和欄位的區別
Time of Update: 2015-11-25
標籤:一、C#的異常處理所用到關鍵字 try 用於檢查發生的異常,並協助發送任何可能的異常。 catch 以控制權更大的方式處理錯誤,可以有多個catch子句。 finally 無論是否引發了異常,finally的代碼塊都將被執行。 throw 用於引發異常,可引發預定義異常和自訂異常。 二、C#異常處理的格式 &
Time of Update: 2015-11-25
標籤:介面效果: 對外提供的屬性設定 /// <summary> /// 背景色 /// </summary> public Color BackColor; /// <summary> /// 邊框顏色 /// </summary> public Color
Time of Update: 2015-11-27
標籤:[csharp] view plaincopyprint? public class DateTimeTool { /// <summary> /// 擷取指定日期所在周的第一天,星期天為第一天 /// </summary> /// <param name="dateTime"></param> ///
Time of Update: 2015-11-25
標籤:字串相似性演算法使用 Levenshtein Distance演算法(中文翻譯:編輯距離演算法) 這演算法是由俄國科學家Levenshtein提出的. 下面使用C#實現public class LevenshteinDistance { private static LevenshteinDistance _instance=null; &
Time of Update: 2015-11-29
標籤:1,簡述private,protected,public,internal修飾符的存取權限private:私人成員,在類的內部才可以訪問protected:保護成員,在該類的內部和繼承類中可以訪問public:公用成員,完全公開,沒有訪問限制internal:當前程式集內可以訪問----------------------------------------------------------------------2,ADO.Net中的五個主要對象Connection:主要是開啟程式和資
Time of Update: 2015-11-25
標籤:1.this.Close(); 只是關閉當前視窗,若不是主表單的話,是無法退出程式的,另外若有託管線程(非主線程),也無法乾淨地退出;2.Application.Exit(); 強制所有訊息中止,退出所有的表單,但是若有託管線程(非主線程),也無法乾淨地退出;3.Application.ExitThread();
Time of Update: 2015-11-25
標籤:public MainWindow(){InitializeComponent();this.Loaded += (s, e) => DiscoverKinectSensor();this.Unloaded += (s, e) => this.kinect = null;}在上面的代碼中,+=是在委託鏈上增加一個委託,(s,e) =>是一個lambda運算式,這個運算式建立一個委託,委託處理的主體就是=> 後面的部分。其實這個寫法相當於this.Loaded +=
Time of Update: 2015-11-25
標籤:首先,大小寫不能寫錯,其次,解決方案配置設為:Debug,才會執行該語句,如果在條件裡面搭配Debug.Assert等,效果甚佳。而如果要設定為Release模式,就不會執行條件陳述式中的內容,有時候可以通過設定!DEBUG來達到發布產品執行的代碼。 範例程式碼: int debugNumber = 0; #if
Time of Update: 2015-11-28
標籤:本章的標題是字串的格式化輸入/輸出,重點介紹輸入和輸出。 本章的第一段範例程式碼和上一張範例程式碼很相近,代碼就不貼了,新出現的特性是使用了一個數組來存放字串,C預先處理命令和strlen()函數。下面具體介紹這些概念。 1.字串 C語言沒有為字串定義專門的變數類型,而是儲存在char數組中。 注意: 1.scanf()讀取字串時,會在遇到第一個空白字串,定位字元或者分行符號處停止讀取。所以使用%s的scanf()只會讀取一個單詞而非整個句子(C語言一般用gets
Time of Update: 2015-11-29
標籤:time_ctime_t實際上是一個長整形的資料類型,用於記錄從1970年1月1日0時0分0秒(UNIX出現的時間)起到當前一共多少秒的時間記錄,然而對於time_t來說它表示的時間的最大值只能到2038 ,所以有一些廠商引入了64位甚至更長來儲存時間。我們通過尋找標頭檔time.h來觀察time_t的定義#ifndef _TIME32_T_DEFINEDtypedef _W64 long __time32_t; /
Time of Update: 2015-11-27
標籤:DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a number line and the cow is at a point K (0
Time of Update: 2015-11-28
標籤:C. Make Palindrome A string is called palindrome if it reads the same from left to right and from right to left. For example "kazak", "oo", "r" and "mikhailrubinchikkihcniburliahkim" are palindroms, but strings "abb" and "ij" are
Time of Update: 2015-11-26
標籤:parametet.mclc;clear;load(‘src.mat‘)CZT_N = 2048;CZT_M = 2048;CZT_W = exp(-j*(2*pi/8192));CZT_A =
Time of Update: 2015-11-25
標籤:本章的標題是資料和C,主要內容是介紹資料類型中的整數類型和浮點數類型。 本章的第一段代碼#include <stdio.h>int main(void){ float weight; /*使用者的體重*/ float value; /*相等重量的銠的價值*/ printf ("Are you worth your weight in rhodium?\n"); printf ("Let‘s check it out.\n");