How Do I reference composite types in my App
Hi All,
I followed the Microsoft example in my WCF Interface.
Code:
[ServiceContract]
public interface IRS
{
[OperationContract]
Boolean MergeData(CompositeType filenameList);.......
[DataContract]
public class CompositeType
{
[DataMember]
public List<String> filenameList { get ; set ; }........
Now in my client code where I'm using trying to use the wcf service I have:
Code:
List<String> localLockton = new List<String>(workLockton);
myService.IRS objIRS;
objIRS.MergeData(localLockton);
however, in the final line. I receive an error : The best overloaded method match for myService.IRS.MergeData(myService.CompositeType) has some invalid arguments.
Followed by Argument 1: cannot convert from System.Collection.Generic.List<string> to myService.CompositeType.
I thought that in my interface of wcf by declaring it mergedata with compositeType I was enforcing the type to be passed.
If I change my client code to:
Code:
myService.IRS objIRS;
myService.CompositeType myList;
myList.filenameList = localLockton; objIRS.MergeData(myList);
I receive an arror on the above line with: cannot implicitly convert type System.Collections.Generic.List<string> to string[]
Re: How Do I reference composite types in my App
Ok,
I found that I needed to re-reference my WCF Service and change the type expected to be passed in the Adavance Settings. This has now cured the problem , however, I'm now having difficulty instanciating and using the Interface.
Code:
MyService.CompositeType myList = new MyService.CompositeType();
myList.filenameList = localLockton;
MyService.IRS objIRS;
objIRS.MergeData(myList);
I get the error: Use of unassigned local variable objIRS. How do I instantiate the interface.?