String str = dt.ToString(); // 轉成字串,例:2012/6/5 下午 04:43:57
- Jun 05 Tue 2012 16:50
-
C# Get now datetime(取得現在時間)
DateTime dt = DateTime.NOw; // 取得現在時間
String str = dt.ToString(); // 轉成字串,例:2012/6/5 下午 04:43:57
String str = dt.ToString(); // 轉成字串,例:2012/6/5 下午 04:43:57
- Oct 14 Thu 2010 15:58
-
Visual Web Developer 2010 Express use SQLite
- Jun 30 Wed 2010 16:03
-
沈默的新技術 WPF
WPF出來好幾年了,微軟的新一代使用者介面,2006年推出時,實在帶給人很大的震撼,但實在是太早出來了,相關的整合配套措施都還沒好,又包山包海,十足是隻怪獸一樣,另一個明顯的缺點就是畫面上的字,看起來都糊糊的,實在傷害眼睛,WPF 4.0有解決了糊糊的問題,花了四年!!
WPF真的出來的太早了,一堆資源找不著了,光要讓我的VS 2005可以開發WPF的程式,就花了我非常多的時間,微軟的網站早就不提供Visual Studio 2005 extensions for .NET Framework 3.0 (WCF & WPF), November 2006 CTP 下載了,搜尋了好久終於下載成功,只能說微軟的手法太高招,逼迫大家提昇VS。
或許WPF是個大躍進,但在Windows Form出來沒多久,MFC還是一堆人最常用的選擇,本身優良開發的ide沒出現,微軟自己產品也沒看到任何一套使用這新技術,所以周邊的人也沒看到誰在用這東東,它可能又要默默的發展幾年,才會讓人去注意吧。
WPF真的出來的太早了,一堆資源找不著了,光要讓我的VS 2005可以開發WPF的程式,就花了我非常多的時間,微軟的網站早就不提供Visual Studio 2005 extensions for .NET Framework 3.0 (WCF & WPF), November 2006 CTP 下載了,搜尋了好久終於下載成功,只能說微軟的手法太高招,逼迫大家提昇VS。
或許WPF是個大躍進,但在Windows Form出來沒多久,MFC還是一堆人最常用的選擇,本身優良開發的ide沒出現,微軟自己產品也沒看到任何一套使用這新技術,所以周邊的人也沒看到誰在用這東東,它可能又要默默的發展幾年,才會讓人去注意吧。
- May 28 Fri 2010 16:05
-
SQLite with Visual Studio 2005

採用 System.Data.SQLite(http://sqlite.phxsoftware.com/) -An open source ADO.NET provider for the SQLite database engine
請至 http://sourceforge.net/projects/sqlite-dotnet2/files/ 下載安裝檔案,我下載的是2010/04/18的版本SQLite-1.0.66.0-setup.exe(下載最新的就對了)。
- May 27 Thu 2010 20:18
-
C# Tutorial – 7. Control Statements Tutorial
- May 18 Tue 2010 16:57
-
C# Tutorial - 6. String Tutorial
- May 17 Mon 2010 16:22
-
C# Tutorial - 5. Array Tutorial
陣列是各語言最常用的資料結構,本文主要介紹C#操作陣列的方法,以供有興趣的朋友參考。
陣列是一種資料結構,其中會包含多個相同型別的變數。陣列是用型別宣告:
type[] arrayName;
陣列是一種資料結構,其中會包含多個相同型別的變數。陣列是用型別宣告:
type[] arrayName;
- May 17 Mon 2010 15:45
-
C# Tutorial - 4. Statements and Expression Tutorial
本文主要介紹C#最基本要件和運算式,以供有興趣的朋友參考。
Statements
Statement為C#最基本的組成,所有程式都是由Statement建構的,可以宣告區域變數、常數、呼叫方法、建立物件,或指派值給變數、屬性或欄位。
Statements
Statement為C#最基本的組成,所有程式都是由Statement建構的,可以宣告區域變數、常數、呼叫方法、建立物件,或指派值給變數、屬性或欄位。
- May 17 Mon 2010 11:41
-
C# Tutorial - 3. Operators, Types, and Variables Tutorial
- May 12 Wed 2010 13:48
-
C# Tutorial - 2. Command Line Arguments Tutorial
本文主要介紹C#如何處理從Command line帶進來的變數值,以供有興趣的朋友參考。
using System;
using System.Collections.Generic;
using System.Text;
namespace CmdLineInput
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("You entered the following {0} command line arguments:", args.Length);
for (int i = 0; i < args.Length; i++) {
Console.WriteLine("{0}", args[i]);
}
}
}
}
Output:
You entered the following 4 command line arguments:
A
B
C
D
說明:
1. 不像 C 和 C++,程式名稱不會當做第一個命令列引數處理。
2. 使用 for 迴圈, 將帶入的參數逐一顯示在 console 上.
另一種方式, 使用 foreach statement
using System;
using System.Collections.Generic;
using System.Text;
namespace CmdLineArgus
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("You entered the following {0} command line arguments:", args.Length);
foreach (string s in args)
{
Console.WriteLine("{0}", s);
}
}
}
}
說明:
1. foreach 提供了一個簡單且清楚的方法來逐一查看陣列中的元素.
* 用 console mode 啟動測式應該都很OK, 但大部分都是殺雞用牛刀, 使用Visual Studio編輯器請照下面步驟:
Project -> 專案名稱的 Properties -> Debug -> Start Option -> Command line arguments
然後輸入程式啟始時想帶入的參數, 如 A B C D
using System;
using System.Collections.Generic;
using System.Text;
namespace CmdLineInput
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("You entered the following {0} command line arguments:", args.Length);
for (int i = 0; i < args.Length; i++) {
Console.WriteLine("{0}", args[i]);
}
}
}
}
Output:
You entered the following 4 command line arguments:
A
B
C
D
說明:
1. 不像 C 和 C++,程式名稱不會當做第一個命令列引數處理。
2. 使用 for 迴圈, 將帶入的參數逐一顯示在 console 上.
另一種方式, 使用 foreach statement
using System;
using System.Collections.Generic;
using System.Text;
namespace CmdLineArgus
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("You entered the following {0} command line arguments:", args.Length);
foreach (string s in args)
{
Console.WriteLine("{0}", s);
}
}
}
}
說明:
1. foreach 提供了一個簡單且清楚的方法來逐一查看陣列中的元素.
* 用 console mode 啟動測式應該都很OK, 但大部分都是殺雞用牛刀, 使用Visual Studio編輯器請照下面步驟:
Project -> 專案名稱的 Properties -> Debug -> Start Option -> Command line arguments
然後輸入程式啟始時想帶入的參數, 如 A B C D
- May 12 Wed 2010 12:28
-
C# Tutorial - 1. Hello World Tutorial
所有語言的第一個程式, Hello World
來點不一樣的, Hello C#, :)
using System;
using System.Collections.Generic;
using System.Text;
namespace Hello1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, C#");
}
}
}
說明:
1. Main 方法是程式的進入點,程式控制會在此開始和結束。
Main method 必須在類別或結構中宣告。它必須為靜態且不應該為 public
傳回型別可以是 void 或 int。
2. WriteLine method 屬於 System.Console class, 用來將資料顯示在 console 中.
程式碼其實可以更簡潔一點, 只是用Visual Studio產生專案時, 會加了一堆東西
來點不一樣的, Hello C#, :)
using System;
using System.Collections.Generic;
using System.Text;
namespace Hello1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, C#");
}
}
}
說明:
1. Main 方法是程式的進入點,程式控制會在此開始和結束。
Main method 必須在類別或結構中宣告。它必須為靜態且不應該為 public
傳回型別可以是 void 或 int。
2. WriteLine method 屬於 System.Console class, 用來將資料顯示在 console 中.
程式碼其實可以更簡潔一點, 只是用Visual Studio產生專案時, 會加了一堆東西
1