可能重複: 「const correctness」 in C# 我懷疑const被簡化爲一般的語言簡單的C#規範。是否有一個特定的原因,我們不能像C++那樣將變量引用或方法聲明爲const?例如: const MyObject o = new MyObject(); // Want const cast referenece of MyObject
o.SomeMethod(); // Theo
結束了,我有以下程序(全部源): using Mono.Unix;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Syste