C# 常數+陣列變數 類別
C# 常數+陣列變數 類別
資料來源:https://docs.microsoft.com/zh-tw/dotnet/csharp/programming-guide/classes-and-structs/constants
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
public class constVar
{
public const int months = 12;
public const int weeks = 52;
public const int days = 365;
static public int[] ALL = new int[3] { months, weeks, days };
}
class Program
{
static void pause()
{
Console.Write("Press any key to continue ...");
Console.ReadKey(true);
}
static void Main(string[] args)
{
Console.WriteLine(constVar.days);
Console.WriteLine(constVar.ALL[2]);
pause();
}
}
}
One thought on “C# 常數+陣列變數 類別”
C# 陣列 宣告 初始化 設定初始直
byte[] bCommand = new byte[] { 0x02, 0x01, 0x0E };