摘要:(200-07-02) C#.NET 類別 摸擬 列舉清單
*當使用一個列舉時 如預到 列舉名稱無法命名則使用此 Const 定義方法 如: asp.net ( . 無法命名 )
類別定義
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace csmod03
{
public class NETType
{
//常數
public const String asp = "ASP.NET";
public const String php = "php5";
public const String jsp = "jsp Servlet";
}
}主程式
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace csmod03
{
class TestConst
{
public static void Main()
{
String item = NETType.asp;
switch (item)
{
case NETType.asp:
System.Console.WriteLine(item);
break;
case NETType.jsp:
break;
}
}
}
}