how to pass to a .NET object a struct ?

2 次查看(过去 30 天)
timo
timo 2015-4-25
I know that a limitation is that u cannot pass to a .NET queue element a struct or array of structs.
My requirement is that I have queues whose elements are matlab structs elements How can I use the .NET Queue with MATLAB native structs? I mean is there a extra step trick I could do ?
Example: I have 5 MATLAB structs elements who I want to put in a .NET Queue and the use push , get from the .NET Queue who will get or put in queue structs elememts....
I tried with Numbers and it works,
t = NET.createGeneric('System.Collections.Generic.Queue',{'System.Double'},10);
t.Enqueue(1)
t.Enqueue(2)
t.Enqueue(3)
x=t.GetEnumerator();
while x.MoveNext();
disp(x.Current)
end
but when I try to use structs I get an error
t = NET.createGeneric('System.Collections.Generic.Queue',{'System.Object'},10);
c=struct('cockyStruct',1);
No method 'Enqueue' with matching signature found for class 'System.Collections.Generic.Queue<System*Object>'.
Is there a trick or extra step I could do ?

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Microsoft .NET 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by