FoxPro and .NET Interop
Creating List<T> with wwDotNetBridge
Gravatar is a globally recognized avatar based on your email address. Creating List<T> with wwDotNetBridge
  Joe Kaufman
  All
  Nov 7, 2018 @ 06:28pm

Rick,

One more DocuWare challenge. For things like changing the indexes on existing documents, DocuWare heavily uses List<T> types. I don't know how to create those with the interop. You'd like to think they had all the constructors and methods set up to just return what you need, but they don't. Lot's of required C# code needs to create a List on the fly, in place, to act as a property of something larger, like:

    indexInfo = new Document();
    indexInfo.Fields = new List<DocumentIndexField>();

This constructs a List of T right into a property of an existing object, and I can't seem to wrap my head around how to do that with wwDotNetBridge. Can *oBridge.CreateInstance() *create a List of T? I tried using the full syntax, but the error said no type was loaded. I am not sure how to get System.Collections.Generic loaded since it isn't there by default and I would have to dig around to find the right DLL (and worry about having the right version, etc., not to mention dependencies?).

As you have said before, if I wrote a wrapper that that let me build everything via a simpler interface (from Foxpro's point of view), this could work. But I am not sure if I would be barking up the wrong tree there. I have consumed a List with FromEnumerable(), and that worked great. This seems to be sort of the opposite of that, though. Any examples of working with Lists from Foxpro while leaving everything in the .NET world: adding new List items, removing, even doing LINQ stuff? (LINQ also hurts my head, but dang it is sweet when it gets things done).

Thanks,

JoeK

Gravatar is a globally recognized avatar based on your email address. re: Creating List<T> with wwDotNetBridge
  Joe Kaufman
  Joe Kaufman
  Nov 8, 2018 @ 07:43am

(This issue has been resolved on the other thread about "A .NET object I cannot manipulate" -- Thanks, Rick!)

© 1996-2024