public static SciterValue FromDictionary(IDictionary <string, SciterValue> dic) { SciterValue sv = new SciterValue(); foreach (var item in dic) { sv.SetItem(new SciterValue(item.Key), new SciterValue(item.Value)); } return(sv); }
public static SciterValue FromList <T>(IList <T> list) where T : /*struct,*/ IConvertible { SciterValue sv = new SciterValue(); for (int i = 0; i < list.Count; i++) { sv.SetItem(i, new SciterValue(list[i])); } return(sv); }
public static SciterValue FromDictionary <T>(IDictionary <string, T> dic) where T : /*struct,*/ IConvertible { SciterValue sv = new SciterValue(); foreach (var item in dic) { sv.SetItem(new SciterValue(item.Key), new SciterValue(item.Value)); } return(sv); }
public static SciterValue FromList <T>(IList <T> list) where T : /*struct,*/ IConvertible { Debug.Assert(list != null); SciterValue sv = new SciterValue(); if (list.Count == 0) { _api.ValueIntDataSet(ref sv._data, 0, (uint)SciterXValue.VALUE_TYPE.T_ARRAY, 0); return(sv); } for (int i = 0; i < list.Count; i++) { sv.SetItem(i, new SciterValue(list[i])); } return(sv); }
/// <summary> /// Constructs a TIScript array T[] where T is a basic type like int or string /// </summary> public static SciterValue FromList <T>(IEnumerable <T> list) where T : /*struct,*/ IConvertible { Debug.Assert(list != null); SciterValue sv = new SciterValue(); if (list.Count() == 0) { _api.ValueIntDataSet(ref sv._data, 0, (uint)SciterXValue.VALUE_TYPE.T_ARRAY, 0); return(sv); } int i = 0; foreach (var item in list) { sv.SetItem(i++, new SciterValue(item)); } return(sv); }