Jayesh
Jayesh

Reputation: 3951

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

Upvotes: 4

Views: 6332

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038710

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].

Upvotes: 5

Related Questions