We're using the Enterprise WSDL to write a service that will be run from our server and sync data to Salesforce. We're using C# to do this.
I have several functions that perform SOAP operations on lists of generic sObjects such as
public void upsertSObjects(List<sObject> sobjs, string externalIdField){
...
}
My custom objects are defined properly in the class generated by the WSDL. For example:
public partial class MyCustomObject__c : sObject {
...
}
Following the rules of polymorphism, one would expect that I would be able to do the following:
List<MyCustomObject__c> myList = new List<MyCustomObject__c>();
//populate the list with records
upsertSObjects(myList, "ExtId__c");
However, I get a compilation error:
Argument 1: cannot convert from 'System.Collections.Generic.List<namespace.MyCustomObject__c>' to 'System.Collections.Generic.List<namespace.sObject>'