c# - What is static indexer? -
this question has answer here:
- are static indexers not supported in c#? [duplicate] 3 answers
- static indexers? 4 answers
an interviewer asked me question, puzzled term because understand "static" member , i'm familiar concept of "index" meant static indexer
? did searching of own unable find satisfactory definition.
static indexer not possible in c#
indexer semantics require 'this' keyword defines block of code indexer, , reference current instance of class. since static indexer have no such reference, stands reason can't define indexer static. that's personal interpretation, there may bigger picture that.
however, if have special need, indexers convenience - can accomplish want old fashioned way through methods.
the fact of matter is, however, indexers can't defined static.
Comments
Post a Comment