我有以下代码:
PropertyInfo[] originalProperties = myType.GetProperties();
我想从 originalProperties
中排除所有索引器(myVar["key"] 显示为名为“Item”的属性)。
什么是正确的方法?
排除 propInfo.Name == "Item"
不是选项的所有属性。
最佳答案
调用PropertyInfo.GetIndexParameters
- 如果返回的数组为空,则它不是索引器。
关于c# - 属性信息 : is the property an indexer?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4746188/