Time of Update: 2015-09-04
標籤: class Program { static void Main(string[] args) { //串連資料庫 using (MySqlConnection conn = new MySqlConnection("Server=127.0.0.1;Database=study;uid=root;pwd=root;Charset=utf8")) //建立Mysql對象
Time of Update: 2015-09-04
標籤:測試類別 public class Script_Common { public string read(string filename) { return System.IO.File.ReadAllText(filename); } public void log(object obj) { Console.WriteLine(obj.GetType() + "
Time of Update: 2015-09-04
標籤:vb.net vs c# 詳細的Operators運算子區別vb.net=====================Comparison= < > <= >= <>Arithmetic+ - * /Mod\ (integer division)^ (raise to a power)Assignment= += -= *= /= \= ^= <<= >>= &=BitwiseAnd
Time of Update: 2015-09-04
標籤:1.並發:同時做多件事情。2.多線程:並發的一種形式,它採用多個線程來執行程式。多線程是並發的一種形式,但不是唯一的形式。3.線程池存放任務的隊列,這個隊列能夠根據需要自行調整。相應地,線程池產生了另一個重要的並發形式:並發處理。並發處理:把正在執行的大量的任務分割成小塊,分配給多個同時啟動並執行線程。4.非同步編程:並發的一種形式,它採用future模式或回調(callback)機制,以避免產生不必要的線程。5.非同步編程的核心理念是非同步作業:啟動了的操作將會在一段時間後完成。6.響應
Time of Update: 2015-09-04
標籤:c# winform wcf 調試 服務端 方法一:服務端設定:1、開啟需要調試的解決方案,在WCF服務端項目上右鍵,將其設定為啟動項目2、在該解決方案下點擊或者直接按F5啟動WCF服務端項目。3、尋找連接埠號碼:i、方式一啟動調試後,瀏覽器中會出現下面的介面需要留意的是地址欄中的連接埠號碼。ii、方式二:在啟動WCF服務
Time of Update: 2015-09-04
標籤:using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Net;using System.Text;using System.Text.RegularExpressions;using System.Threading.Tasks;namespace 正則{ class Program { static void
Time of Update: 2015-09-04
標籤:上面是我建立的Winform表單,拉控制項就這樣,groupbox顯示檔案的相關資訊代碼如下: //執行個體化檔案對話方塊的類對象 OpenFileDialog ofg = new OpenFileDialog();
Time of Update: 2015-09-04
標籤:using System;using System.Collections;using System.Collections.Generic;using System.IO;namespace codeTest{ class Program { static void Main(string[] args) { //通過反射來擷取Attribute中的資訊 MyAttribute myattribute;
Time of Update: 2015-09-04
標籤:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.IO;using System.Collections;namespace ConsoleApplication2{ class Program { &
Time of Update: 2015-09-04
標籤:1. byte array -> char arrayByte[] b=new byte[5]{0x01,0x02,0x03,0x04,0x05}; Char[] c=Encoding.ASCII.GetChars(b); 2. char array -> byte arrayChar[] c=new char[5]{a,b,c,d,e}; Byte[] b=Encoding.Default.GetBytes(c); Char[]
Time of Update: 2015-09-03
標籤:1、c#整型轉字元型,不足2位的在前面補0。//1->011.ToString().PadLeft(2,‘0‘); 2、Convert.ToString(str1)和str1.ToString()這兩個方法有什麼區別?ToString()是將類型轉換為字串而Convert.ToString()是強制轉換為字串。如果是空的引用。那就只能用強轉,因為如果是ToString()的話會引發異常 。convert.tostring() 是強制轉換,tostring()
Time of Update: 2015-09-03
標籤:APM(Asynchrocous Programming Model)方式:通過委託類非同步呼叫方法:1.定義一個委託類型:delegate int MyDeletateType(string s);2.執行個體化一個委託執行個體,構造時候傳入需要非同步呼叫的函數FuncAvar del = new MyDeletateType(FuncA);int FuncA(string a){Console.WriteLine(a);return 1;}或者var del = new
Time of Update: 2015-09-03
標籤:1.基類和擴充類(1)C#實現繼承的方式:類繼承和介面繼承(2)繼承用冒號(:)表示。被繼承的叫做父類或者基類,從基類繼承的類叫擴充類,又叫衍生類別或子類。所有類的基類System.Object聲明方式:[存取修飾詞]class 擴充類名稱:基類名稱 { }若B繼承自A,也可以使用強制轉換操作將其轉換為A對象。如:A b=(A)new
Time of Update: 2015-09-03
標籤:C#判斷系統是64位還是32位的時候引用了一串代碼,這個代碼是從園子裡面其他博文中轉載過來的,引入自己的項目中發現無法使用,在引用了相應的命名空間之後還是提示: “未能找到類型或命名空間名稱“ConnectionOptions”(是否缺少 using 指令或程式集引用?)”; 除了使用 using System.Management; 還需要在解決方案的“引用”中引用才能夠起作用, private string
Time of Update: 2015-09-04
標籤:C 檔案直接包含有一部分代碼很大,在很多函數中重複,可以直接寫在另外的一個檔案中,引用時直接包含。co.cpp兩個函數都 包含c1.cxx。 點擊(此處)摺疊或開啟////// co.cpp#include <stdio.h>#include <stdlib.h>void f1(int i){ int a; #include
Time of Update: 2015-09-04
標籤:c friend -- 友元友元用於突破protected 或者 private 保護的限制,首先要做的是在被訪問者的類中聲明是友元函數或者友元類。代碼如下#include <iostream>using namespace std;class Square{ private: &
Time of Update: 2015-09-04
標籤:
Time of Update: 2015-09-03
標籤:C. SequenceTime Limit: 1 Sec Memory Limit: 256 MB題目串連http://codeforces.com/gym/100114DescriptionInteger sequences are very interesting mathematical objects. Let us examine a sequence generated with the use of two operations: doubling
Time of Update: 2015-09-03
標籤:int isspace( char c ){char comp[] = { ‘ ‘, ‘\t‘, ‘\r‘, ‘\n‘, ‘\v‘, ‘\f‘ };const int len = 6;for ( int i=0; i<len; ++i ){if ( c == comp[i] )return 1;}return 0;}char tolower( char c ){if ( c >= ‘A‘ && c <= ‘Z‘ )return ( c + 32
Time of Update: 2015-09-03
標籤:位域 : 有些資訊在儲存時,並不需要佔用一個完整的位元組, 而只需占幾個或一個二進位位。例如在存放一個開關量時,只有0和1 兩種狀態, 用一位二進位即可。為了節省儲存空間,並使處理簡便,C語言又提供了一種資料結構,稱為“位域”或“位段”。所謂“位域”是把一個位元組中的二進位劃分為幾 個不同的地區,並說明每個地區的位元。每個域有一個網域名稱,允許在程式中按網域名稱進行操作。