Time of Update: 2018-12-07
一.基本以下的模版類型關鍵字class在新C++標準中建議使用typename代替.1.1通用函數template <class Ttype> re-type func-name(parameter list){ //body of funtion}例如:template <class X> void swap(X &a,X &b){ X temp; temp = a; a = b; b =
Time of Update: 2018-12-07
寫此段代碼的原因是為了證明坎子的程式的可最佳化性,隨寫此代碼~~~當然,上班時間偷閑的匆匆之作,My
Time of Update: 2018-12-07
VB.net 如果需要單一實例運行,只要在其屬性中選中一個複選框就OK了,簡單得不能再簡單了。。。在 C# 中,天生不支援單一實例運行,如果想要單一實例,處理起來很複製。簡單點的有 尋找進程資訊、線程同步等。用起來很不爽。在 VS2008 的 MSDN 中,搜尋 “單一實例”,找到了MS官方的實現方法。頁面地址:單一實例檢測樣本ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.chs/wpf_samples/html/c283e8e9-6fb5-494f-9600-826
Time of Update: 2018-12-07
Abstract若想將container中的iterator,從一個值取代成另外一個值,但container並沒有提供replace()這個member function,而是提供了replace()這個Generic
Time of Update: 2018-12-07
CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->using System;using System.Collections.Generic;using System.Text;namespace SortAlgorithm{ class QuickSort { static void Main() {
Time of Update: 2018-12-07
向FTP伺服器下載檔案的簡單一實例CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->string filePath = "d:\\"; string fileName = "lhking.txt"; //檔案下載之後要儲存的路徑和檔案名稱 FtpWebRequest reqFTP;
Time of Update: 2018-12-07
這2個有所區別的小技巧.|位或運算的時候,他會將所有運算條件都算出結果,再判斷是否為真.|| 邏輯或運算的時候,從前往後運算,若有一個成立,則不再繼續運算下面的條件.直接為真.& 與 && 也是同理.用 & 和 && 打個比方.txtName 是個textbox.if(txtName != null && txtName.Text != ""){}與if(txtName != null & txtName.Text != "
Time of Update: 2018-12-07
一、關於數組對象和vector對象Account *pact = new Account[10]1.在堆中分配包含10個Account類對象的數組;2.用Account類預設建構函式初始化釋放*pact不要用delete pact只是第一個類對象上調用了解構函式;應該使用delete [] pact;vector<Point> vec(5);//I初始化過程
Time of Update: 2018-12-07
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Threading;using System.Diagnostics;namespace _{ public partial class Form1 :
Time of Update: 2018-12-07
#include <iostream>using namespace std;int multi(const int a[], const int b[], int c[], const int len){ for (int k=0; k<2*len-1; k++) { for (int i=0; (i<k+1)&&(i<len); i++) { if (k-i<len) { int temp=a[i]*b[k-i];
Time of Update: 2018-12-07
stringstr1 =string.Format("{0:N1}",56789); //result: 56,789.0stringstr2 =string.Format("{0:N2}",56789); //result: 56,789.00stringstr3 =string.Format("{0:N3}",56789); //result: 56,789.000stringstr8
Time of Update: 2018-12-07
[Serializable] public class SolidButton : Button, ISerializable { public SolidButton(SerializationInfo info, StreamingContext ctxt) { this.Location = new Point((int)info.GetValue("X", typeof(int)),
Time of Update: 2018-12-07
利用設計模式可以使我們的代碼更靈活,更容易擴充,更容易維護。各種物件導向的程式設計語言都提供了基本相同的機制:比如類、繼承、派生、多態等等。但是又有各自的特色,C# 中的反射機制便是一個很重要的工具,好好地利用就可以在實際中發揮很大的作用。我們來看一個例子:我的程式中有需要一系列的對象,比如apple,orange…, 要想利用他們,我們就必須在程式中根據使用者要求,然後一個個調用 new
Time of Update: 2018-12-07
代理:代理的本質是對另一個類中的函數的引用,可以分排和使用函數而無需知道它來自哪個類,只要函數滿足同樣的介面就可以 C#中任何事物都看作對象。 受管語言被編譯成中間低層語言,使用通用語言運時(CLR)執行編譯後的代碼,或是進一步編譯這些代碼受管語言都是垃圾自動收集的。垃圾自動收集語言負責釋放不用的記憶體,當變數,數組或對象被檢測不再被引用,就把相應的記憶體空間釋放回系統 每個控制項基本上都被聲明為一個變數,並被添加到一個容器裡。 C#中變數和類方法可以聲明為:Public
Time of Update: 2018-12-07
原文地址:http://www.cnblogs.com/SoulStore/archive/2007/06/19/788468.htmlC#追加檔案 StreamWriter sw = File.AppendText(Server.MapPath(".")+"\\myText.txt"); sw.WriteLine("追逐理想"); sw.WriteLine("kzlll"); sw.WriteLine(".NET筆記"); sw.Flush(); sw.Close(); C#拷貝檔案
Time of Update: 2018-12-07
C#枚舉類型的使用樣本
Time of Update: 2018-12-07
SqlServer CodeSmith csbigint Int64 Int64binary Binary System.Byte[]bit Boolean
Time of Update: 2018-12-07
前幾天在項目中碰到的驗證問題,由於不適合用驗證控制項,所以只好自己寫了一個驗證方法,貼上來。。。 using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using
Time of Update: 2018-12-07
Abstract前一篇(原創) 如何使用C語言的標準函式庫進行排序? (C)談到使用C語言stdlib.h的qsort()對array進行排序,C++呢?STL也提供了sort() algorithm。IntroductionSTL的sort()不僅僅支援array,還支援其餘的container如vector,list等,這也是泛型之美,container和algorithm徹底decouple,讓algorithm可以支援各種container,達到最大的reuse,由於STL是C++ 98
Time of Update: 2018-12-07
若要將vector中反過來列印,該怎麼做呢?STL提供了reverse_iterator。 1/**//* 2(C) OOMusou 2006 http://oomusou.cnblogs.com 3 4Filename : ReverseIterator.cpp 5Compiler : Visual C++ 8.0 / ISO C++ 6Description : Demo how to use reverse_iterator 7Release : 12/17/2006