2012-07-01から1ヶ月間の記事一覧

インデクサ

C#

C#では[]演算子のオーバーロードを行う場合、インデクサというものを使用します。 using System; using System.Collections; class IndexerDemo{ private Hashtable ht = new Hashtable(); /// Constructor public IndexerDemo() { ht.Add("one", 1); ht.Add…

プロパティ

C#

オブジェクトのプロパティを介して、データの読み込み・変更を行うことが出来ます。 class PropDemo{ private int n; private bool valid; /// Property /// Property can not overloading. public int MyProperty { // get accessor get { return n; } // s…