ni.com checkout is currently experiencing issues.
Support teams are actively working on the resolution.
ni.com checkout is currently experiencing issues.
Support teams are actively working on the resolution.
12-02-2019 06:47 AM
Dear community
As I have read NXG4 is capable of working with .NET I started to migrate my xDocument implementation for fast XML handling in NXG4.
Now it stopped at the following step.
I want to call the .NET method Elements(XName name) which should return the Elements as "system.collection.generic.ienumerable"
The method Elements(XName name) is not existing in the available methods.
Is this due to the missing implementation of generics ?? or is there a workaround to solve this problem ?
Thank you for your clarification
12-09-2019 11:22 AM
Hello nottilie,
The issue you are seeing is because we do not support generic parameters on .NET methods. Because the return type is an iEnumerable, we don't create the entry point for that method. In LabVIEW 2019, this method would be supported by returning a reference to the .NET iEnumerable which you could use methods like "Current()" or "MoveNext()" to get individual elements out of the ienumerable.
However, this is something we are planning on supporting in the near term. Our current plan is that functions that return a closed iEnumerable (like the example you mentioned), would return an array of the elements. This allows LabVIEW users to be able to interact with the data in a more native format.
Would this proposed solution solve the current functionality gap that you are describing?
12-10-2019 01:24 AM
Thank you for your answer.
I already have implemented the solution you suggested in LV2019 and it worked perfectly, but I wanted to migrate a few projects to NXG4.
I did not find any good possibility to parse XML strings or files in NXG 4.
So currently I am a little stucked because of missing XML functionality in NXG4.
Best regards
12-10-2019 04:38 AM
@Jon_S. wrote:Would this proposed solution solve the current functionality gap that you are describing?
What if I just want the first element from a huge array? Always returning all elements could be a waste of resources.
12-11-2019 01:30 PM
wiebe@CARYA wrote:What if I just want the first element from a huge array? Always returning all elements could be a waste of resources.
You are correct that if you have a large number of iEnumerable and you ONLY wanted the first item, this implementation would use more memory than getting the IEnumerable and accessing the only first element. If you wanted to operate on all of the items, getting the IEnumerable and accessing every element via MoveNext() and GetCurrent() would be slower than iterating through every item via an array and a For Loop.
The long term vision of the DNI document is that we can allow users to configure the functions to marshal data differently. We can imagine scenarios where you would want the DNI to marshal directly to arrays or IEnumerable.
12-12-2019 02:37 AM
@Jon_S. wrote:
wiebe@CARYA wrote:What if I just want the first element from a huge array? Always returning all elements could be a waste of resources.
You are correct that if you have a large number of iEnumerable and you ONLY wanted the first item, this implementation would use more memory than getting the IEnumerable and accessing the only first element. DNI to marshal directly to arrays or IEnumerable.
Well, in any situation where you want to iterate and stop when an item is found, enumeration could be faster than always returning everything.
It doesn't need to be the 1 element. If you want (after iterating) the 100th element out of a 1M array, iterating would still be faster.
Getting an array does seem very convenient, BTW. But perhaps it should be an option.
04-15-2020 12:07 AM
04-17-2020 12:59 PM
Hi Smart_Li,
I don't have a specific update on when support for closed IEnumerable will exist in LabVIEW NXG - it is on our roadmap to deliver that in the next year or two, but it will not be in the next couple of versions of LabVIEW NXG. My recommendation is that you stick with LabVIEW until the .NET integration in LabVIEW NXG meets your requirements. We have identified .NET integration as an area we want to make significant improvements in LabVIEW NXG compared to what you can do in LabVIEW 2020 - including better support for generic types, but those improvements are further out.
Thanks,
Jeff Peacock
Productization Lead for Language in LabVIEW NXG
LabVIEW R&D