Weakness of Human Nature: inertia of thinking

Source: Internet
Author: User

Environment: win2003 + vs2003 +. NET Framework SP1
According to msdn, The listview has selectedindexcollection class,
Available

Listview. selectedindexcollection Indexes =  
This . Listview1.selectedindices;

But in vs2003, after the listview. Is input, there is no selectedindexcollection prompt;
If system. Windows. Forms. listview. selectedindexcollection A = listview1.selectedindices; is compiled, but vs2003 does not prompt the selectedindexcollection class.
Use reflector to view listview. The selectedindexcollection class exists and is defined as follows:

Public   Class Selectedindexcollection: ilist, icollection, ienumerable
{
// Methods
Public Selectedindexcollection (listview owner );
Public   Bool Contains ( Int Selectedindex );
Public   Void Copyto (array DEST, Int Index );
Public Ienumerator getenumerator ();
Public   Int Indexof ( Int Selectedindex );
Bool Icollection. get_issynchronized ();
Object Icollection. get_syncroot ();
Int Ilist. Add ( Object Value );
Void Ilist. Clear ();
Bool Ilist. Contains ( Object Selectedindex );
Bool Ilist. get_isfixedsize ();
Object Ilist. get_item ( Int Index );
Int Ilist. indexof ( Object Selectedindex );
Void Ilist. insert ( Int Index, Object Value );
Void Ilist. Remove ( Object Value );
Void Ilist. removeat ( Int Index );
Void Ilist. set_item ( Int Index, Object Value );

// Properties
[Browsable ( False )]
Public   Int Count {Get;}
Private   Int [] Indicesarray {Get;}
Public   Bool Isreadonly {Get;}
Public   Int   This [ Int Index] {Get;}

// Fields
Private Listview owner;
}

 
Note: subclass calls in a class are called using the class name, which is similar to static methods in the call class. So use

System. Windows. Forms. listview. selectedindexcollection = Listview1.selectedindices

Only a bug exists in the Chinese version of vs2003 and does not prompt that selectedindexcollection exists. For people like me who use vs2003 and like it, beware of thinking inertia and trust Microsoft too much.
Everything requires hands-on verification. You only need to think about misunderstandings. Note: "You have to get a glimpse of it on the paper. You must know that this is the case ".
It seems that it is good to manually compile the source code using a text-based editor.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.