mirror of
https://github.com/qmlnet/qmlnet.git
synced 2026-05-21 06:45:32 -06:00
Removing the try catch, swallowing exceptions.
Made the INetJsValue.AsList method more friendly to different types.
This commit is contained in:
parent
df051b8582
commit
9e213aac55
1 changed files with 10 additions and 12 deletions
|
|
@ -1,4 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Qml.Net.Extensions
|
||||
{
|
||||
|
|
@ -17,23 +19,19 @@ namespace Qml.Net.Extensions
|
|||
return null;
|
||||
}
|
||||
|
||||
var destinationConverter = TypeDescriptor.GetConverter(typeof(T));
|
||||
|
||||
var list = new List<T>();
|
||||
try
|
||||
{
|
||||
|
||||
var length = (int)value.GetProperty("length");
|
||||
|
||||
for (var i = 0; i < length; i++)
|
||||
{
|
||||
var item = value.GetItemAtIndex(i);
|
||||
list.Add((T)item);
|
||||
list.Add((T)destinationConverter.ConvertFrom(null, CultureInfo.InvariantCulture, item));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue