- #define Default
- #define DovelopmentMode
- #define TestingMode
- #undef DovelopmentMode
- #if DEBUG
- #warning You should not compile in debug mode, use release mode
- #endif
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace SampleApplication
- {
- class Program
- {
- static void Main(string[] args)
- {
- String orgName=String.Empty;
- String email=String.Empty;
- String SourceDb=String.Empty;
- #if(DovelopmentMode)
- {
- SourceDb="C:\\\\DovDb.Mdb"; //This Db used at the time of dovelopment phase
- }
- #else
- {
- SourceDb = "C:\\\\TestDb.Mdb";//This Db used at the time of testing
- }
- #endif
- #if(Default)
- {
- orgName = "MyOrganization";
- email = "Default@gmail.com";
- const string logName = @"\\myLog.log"; //Write log information
- }
- #else
- {
- orgName = fetch from database
- email = fetch from database
- const string logName = fetch from database //Write log information
- }
- #endif
- }
- }
- }
- //该片段来自于http://www.codesnippet.cn/detail/2805201512696.html
来源: http://www.codesnippet.cn/detail/2805201512696.html