This is a migrated thread and some comments may be shown as answers.

List<T> Compiler Error!

1 Answer 26 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
maledong
Top achievements
Rank 1
maledong asked on 09 Sep 2011, 10:22 AM
Hey all the telerik member:)
Here's a feedback from dd——I notice that you've compiled List<T>'s index accessor as the codes below:
public T Item
 {
  get
  {
   if (index >= this._size)
   {
    ThrowHelper.ThrowArgumentOutOfRangeException();
   }
   return this._items[index];
  }
  set
  {
   if (index >= this._size)
   {
    ThrowHelper.ThrowArgumentOutOfRangeException();
   }
   this._items[index] = value;
   this._version = this._version + 1;
  }
 }
Sorry but this is a wrong issue! Because in C# Microsoft suggests us using "this" index accessor instead of Item, and Item is a key word in Visual Basic.——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.
 (See related things at:http://msdn.microsoft.com/zh-cn/library/system.collections.arraylist.item.aspx#Y970)

1 Answer, 1 is accepted

Sort by
0
Tsviatko Yovtchev
Telerik team
answered on 15 Sep 2011, 10:27 AM
Hello Maledong,

 That's definitely wrong. Thanks for letting us know. We'll fix it, so please, updatre regularly.

Greetings,
Tsviatko Yovtchev
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
General Discussions
Asked by
maledong
Top achievements
Rank 1
Answers by
Tsviatko Yovtchev
Telerik team
Share this question
or