Is indexer a special form of property? RRS feed

  • Question

  • Indexer is similar to property.
    but I think indexer isn't special form of property.

    Is indexer a special form of property?

    Wednesday, October 10, 2018 6:30 AM

All replies

  • Hello,

     Technically, Indexer and Property have different mechanics as in code. Review the

    following link to learn exactly the context usage;




     Hope this helps :)

    Wednesday, October 10, 2018 8:25 AM
  • An indexer is basically a property that has a parameter. There are some differences as outlined here.

    You can technically use any parameter you want but generally we use integrals or strings. The predominant use case is to make a list of items look like an array or dictionary.

    Is indexer a special form of a property? I think that depends upon your view. Properties can be seen as special forms of methods. We use them with the field syntax but under the hood they are still just method calls. So you could argue that a property is just a special form of a method. So in that sense an indexer is a special form of a property because an indexer uses array (field) syntax but under the hood calls methods.

    Michael Taylor http://www.michaeltaylorp3.net

    Wednesday, October 10, 2018 2:23 PM