Time of Update: 2018-12-05
使用標準C++的類型轉換符:static_cast、dynamic_cast、reinterpret_cast、和const_cast。1 static_cast用法:static_cast < type-id > ( expression
Time of Update: 2018-12-05
一個結構體可以作為另一個結構體的成員類型:(1)struct phoneBook{ public string name; public uint age; public string phone; public struct address { public string city; public string street; public
Time of Update: 2018-12-05
在c++中,幾種情況共用同一種處理方法時,可以這樣寫:char a;switch(a){caes ‘a’,case ‘b’:{Dosomething(); break;}case ‘c’:……}但在c#中必須如下寫:static void Main() { do { outMsg(0); Console.WriteLine("\n"); char choice = Console.ReadKey(
Time of Update: 2018-12-05
1.多線程操作表單控制項 delegate void SetTextCallback(string text); private void SetText(string text) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating
Time of Update: 2018-12-05
主要參考StoryRanges,NextStoryRange,WdStoryType,Range這幾個類。Replace text in Word textbox objects using VSTO and C#/// <summary>/// 尋找並替換文本/// </summary>/// <param name="wordApp"></param>/// <param name="oldStr"></param>//
Time of Update: 2018-12-05
C/C++是最主要的程式設計語言。這裡列出了50名優秀網站和網頁清單,這些網站提供c/c++原始碼。這份清單提供了原始碼的連結以及它們的小說明。我已儘力包括最佳的C/C++原始碼的網站。這不是一個完整的清單,您有建議可以聯絡我,我將歡迎您的建議,以進一步加強這方面的清單。 1、http://snippets.dzone.com/tag/c/ --數以千計的有用的C語言原始碼片段 2、http://www.hotscripts.com/category/c-cpp/scripts-progra
Time of Update: 2018-12-05
C#遍曆指定檔案夾中的所有檔案 DirectoryInfo TheFolder=new DirectoryInfo(folderFullName);//遍曆檔案夾foreach(DirectoryInfo NextFolder in TheFolder.GetDirectories()) this.listBox1.Items.Add(NextFolder.Name);//遍曆檔案foreach(FileInfo NextFile in TheFolder.GetFiles())
Time of Update: 2018-12-05
2007-09-15 17:26//要求連續輸入五個大寫字母,若有錯誤,提示資訊並重新輸入 using System;class BigT{static void Main(){ Console.WriteLine("請輸入五個大寫字母"); String s = Console.ReadLine(); char []array = s.ToCharArray(); if(array.Length>5||array.Length<5) {
Time of Update: 2018-12-05
2008-03-09 22:07//program.csusing System;using System.Collections.Generic;using System.Windows.Forms;namespace DriveInfo_GetDrives{ static class Program { /// <summary> /// 應用程式的主進入點。 /// </summary>
Time of Update: 2018-12-05
2008-04-10 14:35/*實現方陣轉置 【提示】:該方法應該有兩個參數,一個是要轉置的方陣,另一個是方陣的階數N,方陣的轉置其實就是將行變成列,將列變成行。*/using System;namespace ConsoleApplication3{/// <summary>/// Class1 的摘要說明。/// </summary>class Class1{ /// <summary> /// 應用程式的主進入點。 ///
Time of Update: 2018-12-05
2007-09-13 21:05//接收一個字串,給每個單詞加上雙引號,將其中的"no"替換成"yes"// 不區分大小寫using System;namespace ConsoleApplication1{/// <summary>/// Class1 的摘要說明。/// </summary>class Class1{ /// <summary> /// 應用程式的主進入點。 /// </summary> [STAThread]
Time of Update: 2018-12-05
//本程式示範了最簡單的序列化 和還原序列化 ,將Object Storage Service到本地檔案中 ,//對象序列化的另一個目的是網路傳輸資訊using System;using System.Collections.Generic;using System.Text;using System.IO;using System.Xml.Serialization;using System.Runtime.Serialization;using
Time of Update: 2018-12-05
//以下樣本和說明都源於《visual c# 2005 技術內幕》//匿名函數就是沒有名字的函數,是專用於委託的函數。using System;using System.Collections.Generic;using System.Text;namespace 匿名方法{ public delegate void DelegateClass(); public delegate void delegatec(out int param); public delegate
Time of Update: 2018-12-05
C#特別適合於構造蜘蛛程式,這是因為它已經內建了HTTP訪問和多線程的能力,而這兩種能力對於蜘蛛程式來說都是非常關鍵的。下面是構造一個蜘蛛程式要解決的關鍵問題: ⑴ HTML分析:需要某種HTML解析器來分析蜘蛛程式遇到的每一個頁面。 ⑵ 頁面處理:需要處理每一個下載得到的頁面。下載得到的內容可能要儲存到磁碟,或者進一步分析處理。 ⑶ 多線程:只有擁有多線程能力,蜘蛛程式才能真正做到高效。 ⑷
Time of Update: 2018-12-05
DllImport所在的名字空間 using System.Runtime.InteropServices;MSDN中對DllImportAttribute的解釋是這樣的:可將該屬性應用於方法。DllImportAttribute 屬性提供對從非託管 DLL 匯出的函數進行調用所必需的資訊。作為最低要求,必須提供包含進入點的 DLL 的名稱。DllImport 屬性定義如下:namespace System.Runtime.InteropServices{
Time of Update: 2018-12-05
當一個基類被聲明為虛基類後,即使它成為了多繼承鏈路上的公用基類,最後的衍生類別中也只有它的一個備份。例如:class CBase { };class CDerive1:virtual public CBase{ };class CDerive2:virtual public CBase{ };class CDerive12:public CDerive1,CDerive2{ };則在類CDerive12的對象中,僅有類CBase的一個對象資料虛基類的特點:
Time of Update: 2018-12-05
以下兩個方法有什麼區別?<pre>static void Split(ArrayList source, ArrayList result1, ArrayList result2){ if (source == null) { result1 = null; result2 = null; return; } result1.Add(null); result2.Add(null)
Time of Update: 2018-12-05
C++實現的委託機制(二)作者:gouki04(啊古) 撰寫日期:2011-09-27部落格連結:http://blog.csdn.net/gouki041.實現任意參數的函數委託 按上一篇文章的方法,你已經可以使用無參數的函數委託了。當然,這遠遠不夠。要實現任意參數的函數委託,這裡的任意參數包括任意個數和任意類型。任意類型這個容易解決,使用模板就行,但任意參數個數呢? 註:最終的實現代碼可以在這裡下載:http://download.csdn.net/detail/gouki04
Time of Update: 2018-12-05
C++模板實現的通用Factory 方法模式作者:gouki04(啊古) 撰寫日期:2011-10-29部落格連結:http://blog.csdn.net/gouki041.Factory 方法(Factory Method)模式 Factory 方法模式的意義是定義一個建立產品對象的工廠介面,將實際建立工作延遲到子類當中。核心工廠類不再負責產品的建立,這樣核心類成為一個抽象工廠角色,僅負責具體工廠子類必須實現的介面,這樣進一步抽象化的好處是使得Factory
Time of Update: 2018-12-05
1 #include <iostream> 2 using namespace std; 3 4 #define STR(s) #s // #的用法,轉化為字串 5 #define CONCAT(s1, s2) s1##s2 // ##串連後,作為變數名 6 7 #define MAX(a, b)\ 8 {if((a)>(b))\ 9 return (a);\10