Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem passing array to .NET COM
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Divers
Thread ID:
01523745
Message ID:
01523763
Vues:
73
>My C# COM DLL has a public method with the following signature:
>
>public void AddClientsToList(Contact[] contacts, string listName)
>
>
>In VFP, I do the following:
  • Call a DLL method to get a new contact object
  • Populate the properties
  • Create an array and place the object in the first element
  • Call COMARRAY(loDLL,10)

>When I attempt loDLL.AddClientsToList(@MyArray, "test"), I get a type mismatch COM error.
>
>Any ideas on what I'm doing wrong?

No. But passing arrays of anything is always a pain. Since you have control of both sides maybe it would be simpler to just pass the Contacts in one-by-one? e.g:
public class MyDll
    {
        Dictionary<string, List<Contact>> lists = new Dictionary<string, List<Contact>>();
        public Contact GetNewContact() { return new Contact();}
       
        public void AddClientToList(Contact contact,string listName)
        {
             if (!lists.Keys.Contains(listName))
                lists.Add(listName, new List<Contact>());
            lists[listName].Add(contact);
        }
    }
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform