Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24646] Windows: Hyperloop List.Item (indexer) property does not work

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2017-05-04T23:03:24.000+0000
Affected Version/sHyperloop 2.1.0
Fix Version/sHyperloop 2.1.1
ComponentsWindows
Labelshyperloop-windows
ReporterKota Iguchi
AssigneeKota Iguchi
Created2017-05-02T03:00:04.000+0000
Updated2017-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

Comments

  1. Kota Iguchi 2017-05-02

    https://github.com/appcelerator/hyperloop.next/pull/165
  2. Ewan Harris 2017-05-17

    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.

JSON Source