UsingConstant

使用軟體: Visual c# 2008 Express

常數宣告與使用

-------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class UsingConstant
{
static void Main()
{
int intMyInt = 123 ;
const int myConst = 456 ;

Console.WriteLine("變數 intMyInt = {0}" ,intMyInt);
Console.WriteLine("常數 myConst = {0}" ,myConst);

intMyInt = 321;
Console.WriteLine("變數 intMyInt = {0}" ,intMyInt);
Console.ReadLine();
}
}
}

0 意見: