use indexers
Published: 3. November 2011 | Updated: 3. November 2011License: Microsoft Public License (MS-PL)
Categories: Framework
Tags: C#
Import namespace
using System.Collections.Generic;
Example
public class MyClass { private Dictionary<int, string> _values = new Dictionary<int, string>(); // indexer public string this[int i] { get { return _values[i]; } set { _values[i] = value; } } }
Use
var obj = new MyClass(); obj[1] = "test";
| Send us feedback about this snippet » |





