コード例 #1
0
 /// <summary>
 /// Creates new instance of the indexer
 /// </summary>
 /// <param name="getter">Delegate to the getter function.</param>
 /// <param name="enumerator">
 /// Delegate which returns inumerator for the indexer, or null,
 /// if enumeration is not supported for this indexer.
 /// </param>
 public ReadOnlyNamedIndexer(
     Func <TParam, TType> getter,
     Func <IEnumerator <TType> > enumerator = null)
     : base(enumerator)
 {
     NamedIndexer.Validate("getter", getter);
     this.getter = getter;
 }
コード例 #2
0
ファイル: TestClass.cs プロジェクト: DAud-IcI/NamedIndexers
 public ExampleObject()
 {
     TheNumbers = new NamedIndexer <int, int>(i => _numbers[i], (i, x) => { _numbers[i] = x; });
     Typesetter = new NamedIndexer <int, char>(i => _letters[i], (i, x) => { _letters[i] = x; });
     Double     = new NamedGetter <int, long>(x => 2 * x);
 }
コード例 #3
0
 public UsingIndexers() {
     Indexer = new NamedIndexer<int, int>(Get, Set);
     Getter = new NamedIndexerGetter<int, int>(Get);
     Setter = new NamedIndexerSetter<int, int>(Set);
 }
コード例 #4
0
 /// <summary>
 /// Creates new instance of the indexer
 /// </summary>
 /// <param name="setter">Delegate to the setter function.</param>
 public WriteOnlyNamedIndexer(Action <TParam, TType> setter)
     : base(param => NamedIndexer.FailGet <TType>(), setter)
 {
 }