简体   繁体   中英

What is this syntax: using “this” in property in C#?

I happened to read this line of code:

public MyArray this [int index]{
    get{
        return array[index];
    }
}

Where can I find the document on msdn about the syntax of using "this" in property?

And is there any book covers this kind of tricky syntax of C# other than the common stuff?

这是一个索引器

That's how you write an indexer:

Indexers (C# Programming Guide)

Indexers Tutorial

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM