10-02-2013, 06:21 AM
Quote:I'm guessing that # means number, [p] is put, and [g] is get?Yes, # is int, [g] and [p] are used for properties.
Quote:What I want to do is return a more complex data structureWith many class objects can be used IDispatch.
However cannot return generic types, like List<>. More info: http://msdn.microsoft.com/en-us/library ... 80%29.aspx . Convert List<> to array.
Works with non-generic collections.
Macro test CScript - get collection
out
CsScript x.AddCode("")
IDispatch t=x.CreateObject("Test")
;IDispatch k=t.k ;;error
ARRAY(str) b=t.GetListAsArray ;;OK
for(_i 0 b.len) out b[_i]
IDispatch a=t.a ;;OK
out a.Count
out a.Item(0)
a.Item(0)="newstring"
#ret
using System;
using System.Runtime.InteropServices;
using System.Collections;
using System.Collections.Generic;
public class Test
{
public List<string> k { get; private set;}
public ArrayList a { get; private set;}
public Test()
{
k=new List<string>(); k.Add("string in List");
a=new ArrayList(); a.Add("string in ArrayList");
}
public string[] GetListAsArray() { return k.ToArray(); }
}