由于从propertyinfo集合中排除索引器,是否会出现任何问题 [英] Is there is any problem occur due to exclude indexer from propertyinfo collection

查看:65
本文介绍了由于从propertyinfo集合中排除索引器,是否会出现任何问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个代码

i have a code

PropertyInfo[] Properties = myType.GetProperties();



i exclude使用下面的代码从上面的属性数组索引器


i exclude indexer from above properties array by using below code

ParameterInfo[] parms=propertyInfo.GetIndexParameters();

if(parms.length==0)
{


}



我想知道是否因为使用上述方式从属性信息集合中排除索引器而出现任何问题。请告诉我。


I want to know if there is any problem occur due to exclude indexer from property info collection by using above way.please let me know about that.

推荐答案

是的,你可以这样做: https://msdn.microsoft.com/en-us/library/system.reflection.propertyinfo.getindexparameters%28v = vs.110%29.aspx [ ^ ]。



这个文档告诉你它总是返回数组,但它的长度可以为零,如果属性未编入索引,则会发生这种情况。



-SA
Yes, you can do it exactly this way: https://msdn.microsoft.com/en-us/library/system.reflection.propertyinfo.getindexparameters%28v=vs.110%29.aspx[^].

This documentation tells you that it always returns the array, but its length can be zero, which happens if the property is not indexed.

—SA


这篇关于由于从propertyinfo集合中排除索引器,是否会出现任何问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆