Identifying a custom indexer using reflection in C#

前端 未结 5 1163
隐瞒了意图╮
隐瞒了意图╮ 2020-12-03 16:42

I have a class with a custom indexer like so

public string this[VehicleProperty property]
{
  // Code
}

How can I identify the custom index

5条回答
  •  心在旅途
    2020-12-03 17:24

    Look for the DefaultMemberAttribute defined at type level.

    (This used to be IndexerNameAttribute, but they seem to have dropped it)

提交回复
热议问题