Open dicej opened 2 months ago
note that IEnumerable
doesn't have Count
/Length
but you will likely need to know it upfront to allocate for marshaling. So maybe other interfaces I mentioned would be better fit. Or you could even generate multiple signatures.
I don't know if we also marshal arrays of structs and primitive types (not resources), but in such case Span<T>
and ReadOnlySpan<T>
are better choices. Because those could live on stack. It would also help with stream APIs
Per https://github.com/dotnet/runtimelab/pull/2614#discussion_r1699995101,
List
parameters are often unnecessarily restrictive -- callers might want to pass collections of other types without converting them toList
s first.