Hi,
I am having trouble exposing a C# collection to Classic ASP.
I've tried to use IEnumerable and Array. but I get the "object not a collection
" error.
my method looks like:
public IEnumerable<MyObj> GetMyObj() { ... }
and on the Classic ASP side:
Dim obj, x
Set obj = Server.CreateObject("Namespace.class")
For Each x in obj.GetMyObj
...
So how can I pass a collection to Classic ASP?
UPDATE:
may be this is a progress, the solution I found was to use a new class that inherits IEnumerable
instead of using IEnumerable<MyObj>
:
public class MyEnumerable : IEnumerable
{
private IEnumerable<MyObj> _myObj;
.
.
.
[DispId(-4)]
public IEnumerator GetEnumerator()
{
_myObj.GetEnumerator();
}
}
But now when I try to access a property of MyObj
I get an error: Object required
.
Any idea?