Tag: 静态索引器

静态索引器?

为什么在C#中不允许使用静态索引器? 我看不出为什么他们不应该被允许,而且他们可能是非常有用的。 例如: static class ConfigurationManager { public object this[string name]{ get{ return ConfigurationManager.getProperty(name); } set { ConfigurationManager.editProperty(name, value); } } /// <summary> /// This will write the value to the property. Will overwrite if the property is already there /// </summary> /// <param name="name">Name of the property</param> /// <param name="value">Value to be wrote (calls […]