Time of Update: 2018-12-08
1. 三種常用的字串判空串方法:Length法:bool isEmpty = (str.Length == 0);Empty法:bool isEmpty = (str == String.Empty);General法:bool isEmpty = (str == "");2.
Time of Update: 2018-12-08
複製代碼 代碼如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.DirectoryServices;namespace JH.Framework.Security{ /// /// 電腦使用者和組操作類 /// public class UserAndGroupHelper { private static
Time of Update: 2018-12-08
要點1:cmd命令列的輸入命令netsh wlan set hostednetwork mode=allow ssid=使用者名稱 key=密碼netsh wlan start hostednetworknetsh waln stop hostednetworknetsh interface ip set address name="本地串連" source=dhcp要點2:在C#中調用cmd.exe命令列複製代碼 代碼如下: private void create(string
Time of Update: 2018-12-08
在X86的環境下,var wParam = (int)msg.WParam;工作得很好。在X64的環境下,快速滾動滾輪會出現msg.WParam 轉換為int的時候溢出,(WParam=4263510016)。資訊為:未處理System.OverflowException Message=算術運算導致溢出。 Source=mscorlib StackTrace: 在 System.IntPtr.op_Explicit(IntPtr value) 在
Time of Update: 2018-12-08
http://stevenkobes.com/ctest.html在這個網站上發現一套很有趣的C語言測試題,如果你招聘C語言相關開發人員,或者正在學習C語言,很值得做一做。如果沒有做,下面內容暫時不要看,最好自己先完成一遍。OK,假設你做的答案沒有完全正確,那你可以繼續看下去了,否則,後面內容對你來說就是小菜一碟,不值得看。第一題:#include <setjmp.h>static jmp_buf buf;int main(void){volatile int b = 3;if
Time of Update: 2018-12-08
Java 的設計者是因為討厭C++的複雜,於是Java 非常簡潔,GC 也讓記憶體管理非常方便,C# 是看中了Java 的GC,和虛擬機器技術,希望把微軟的幾大語言整合到.NET 上來。 因此C#從語言上來講並不簡單甚至可以算的上複雜。兩種語言的設計思路也不一樣,Java 是編譯解釋語言,C#是編譯然後編譯運行語言。Java 沒有委託,C# 有委託。Java 傾向於用Interface 實現委託的功能,而 在C# 中,Abstract Class 比Interface 發揮了更大功能。Java
Time of Update: 2018-12-08
1. 如果一個類B在文法上繼承(extend)了類A, 那麼在語義上類B是一個類A.2. 如果一個類B在文法上實現了(implement)介面I, 那麼類B遵從介面I制定的協議.使用abstract class的根本原因在於, 人們希望通過這樣的方式, 表現不同層次的抽象. 而interface的本質是一套協議. 在程式設計的發展中, 人們又發現介面可以用來表示對行為的抽象, 不過, 這隻是interface的一種用法不是其本質.理論結合實際才是最好的學習方式, 不過在這裡,
Time of Update: 2018-12-08
下面列出的特性未必奇怪,有的算是有趣。1)a[2] 等價於 2[a]"aabbccdd"[5] 等價於 5["aabbccdd"]這條特性可以用於使用數組、指標、字串,但不能用在變數定義時。K&R C Programming language
Time of Update: 2018-12-08
1.冒泡法:這是最原始,也是眾所周知的最慢的演算法了。他的名字的由來因為它的工作看來象是冒泡: 複製代碼 代碼如下:#include <iostream.h> void BubbleSort(int* pData,int Count) { int iTemp; for(int i=1;i<Count;i++) { for(int j=Count-1;j>=i;j--) {if(pData[j]<pData[j-1]) { iTemp = pData[j-1];
Time of Update: 2018-12-08
最近在看進程間的通訊,看到了fork()函數,雖然以前用過,這次經過思考加深了理解。現總結如下:1.函數本身 (1)標頭檔 #include<unistd.h> #include<sys/types.h> (2)函數原型 pid_t fork( void); (pid_t 是一個宏定義,其實質是int 被定義在#include<sys/types.h>中) 傳回值: 若成功調用一次則返回兩個值,子進程返回0,父進程返回子進程ID;否則,出錯返回-
Time of Update: 2018-12-08
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;#region #endregionnamespace Find{ public partial class
Time of Update: 2018-12-08
已知有一個XML檔案(bookstore.xml)如下:複製代碼 代碼如下: <?xmlversion="1.0"encoding="gb2312"?> <bookstore> <bookgenre="fantasy"ISBN="2-3631-4"> <title>Oberon'sLegacy</title> <author>Corets,Eva</author>
Time of Update: 2018-12-08
複製代碼 代碼如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;namespace StreamReadWrite{ class Program { static void Main(string[] args) { // Get the directories currently
Time of Update: 2018-12-08
複製代碼 代碼如下: public void CutToF(Stream stream) { Image initImage = Image.FromStream(stream, true); if (initImage.Width <= 480 && initImage.Height <= 480) {
Time of Update: 2018-12-08
1.根據單個分隔字元用split截取例如複製代碼 代碼如下:string st="GT123_1";string[] sArray=st.split("_");即可得到sArray[0]="GT123",sArray[1]="1";2.利用多個字元來分隔字串例如複製代碼 代碼如下:string str = "GTAZB_JiangjBen_123";string[] sArray = str.Split(new char[2] { 'j', '_' });foreach(string e in
Time of Update: 2018-12-08
複製代碼 代碼如下://載入Excel public DataSet LoadDataFromExcel(string filePath) { try { string strConn; //strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath +
Time of Update: 2018-12-08
複製代碼 代碼如下:class Dirctonary { public void DictionaryGet() { Dictionary<int, string> productList = new System.Collections.Generic.Dictionary<int, string>(); productList.Add(1, "ProductionOne");
Time of Update: 2018-12-08
複製代碼 代碼如下:// Create a handler for a click event.button1.Click += delegate(System.Object o, System.EventArgs e) { System.Windows.Forms.MessageBox.Show("Click!"); };// Create a delegate.delegate void Del(int x);// Instantiate the
Time of Update: 2018-12-08
數學庫函式宣告在 math.h 中,主要有:1、abs(x) 求整型數x 的絕對值2、cos(x) x(弧度)的餘弦3、fabs(x) 求浮點數x 的絕對值4、ceil(x) 求不小於x 的最小整數5、floor(x) 求不大於x 的最小整數6、log(x) 求x 的自然對數7、log10(x) 求x 的對數(底為10)8、pow(x, y) 求x 的y 次方函數說明:pow()用來計算以x為底的y次方值,即xy值,然後將結果返回。傳回值:返回x的y次方計算結果。9、sin(x)
Time of Update: 2018-12-08
1. 用Microsoft Visual C++ 6.0編譯的程式,或者發布在Windows 2000/NT/ME/98 系統單純通過拷貝MSVCRxx.DLL檔案到應用程式目錄或system32目錄即可2. 用Visual Studio 2005以上編譯的程式,且發布在Windows XP及以上系統為了減少DLL引發的配置問題(DLL hell),C和C++運行時由並行 (Side-by-Side)