简体   繁体   中英

Passing array to WCF service

Is it possible to pass an array as an argument from a C# code to a WCF web service?

I'm still new to all this.

Please help.

Thanks

Yes absolutely. Your service contract could look like this:

[ServiceContract]
public interface IFooService
{
    void Foo(int[] intArray);
}

If you want to pass an array of some custom type this type needs to be marked with [DataContract] and its properties with [DataMember] .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM