简体   繁体   中英

Does IntelliSense sometimes miss out on some Framework Class properties or methods?

I came across a DbParameterCollection object, which should have an "Item" property inherited from IList, but IntelliSense does not show this object has the Item property. What's wrong here?

From MSDN :

The C# language uses the this keyword to define the indexers instead of implementing the Item property. Visual Basic implements Item as a default property, which provides the same indexing functionality.

In other words, it's a C# syntax thing. Just use list[index] instead of list.Item(index) and you're set.

Probably because the syntax for using the "Item" property (VB) or indexer (C#) is a bit different from the syntax for "normal" properties.

In VB.NET, you would access an item in an IList like this:

myCollection(index) = someValue

In C# it looks like this:

myCollection[index] = someValue;

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