[TIMOB-24646] Windows: Hyperloop List.Item (indexer) property does not work
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2017-05-04T23:03:24.000+0000 |
| Affected Version/s | Hyperloop 2.1.0 |
| Fix Version/s | Hyperloop 2.1.1 |
| Components | Windows |
| Labels | hyperloop-windows |
| Reporter | Kota Iguchi |
| Assignee | Kota Iguchi |
| Created | 2017-05-02T03:00:04.000+0000 |
| Updated | 2017-05-17T11:51:45.000+0000 |
Description
Accessing [Item property \(indexer\) in Generic.List](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1.item?view=netframework-4.7#System_Collections_Generic_List_1_Item_System_Int32_) throws exception. We would like to use an "array-style" syntax to access element of the collection like below.
var List = require('System.Collections.Generic.List<System.Int32>'),
Int32 = require('System.Int32');
var vec = new List();
vec.Add(Int32.cast(0));
vec.Add(Int32.cast(1));
vec.Add(Int32.cast(2));
Ti.API.info(vec[1]); // should print 1
vec[1] = 100;
Ti.API.info(vec[1]); // should print 100
https://github.com/appcelerator/hyperloop.next/pull/165
Verified using: Windows 10 Pro Ti SDK: 6.1.0.v20170516173434 Appc CLI: 6.2.2-master.13 Appc NPM: 4.2.9 Hyperloop: 2.1.1 (https://github.com/appcelerator/hyperloop.next/tree/2_1_X/windows/dist) Windows 10 Mobile emulator Lumia 550 (10.0) Windows Phone 8.1 emulator Lumia 520 (8.1) Able to access a list item using array syntax, able to call functions like IndexOf, Clear etc. with no issues.