Do i *have* to use ObservableCollection in Silverlight WCF client?
- by Simon_Weaver
When accessing Silverlight in WCF you get proxies generated with ObservableCollection
Thats fine when you're databinding, but a little clumsy when you're just calling a method. For instance the following service method :
[OperationContract]
public SearchOrdersMsgOut SearchOrders(ShippingStatusType[] shippingStatuses,
string[] orderId)
{
}
gets generated with ObservableCollection. What! They're just parameters. Why would I ever want to 'observe' them?
I'm fine if I have to do this - but it seems like there should be a way to force simple array structures when I know I'm never databinding - especially on input messages.
I'd much rather do this :
searchCriteria.PaymentStatus = new [] { PaymentStatusType.PaymentFailed, PaymentStatusType.Unpaid };
than this :
searchCriteria.PaymentStatus = new ObservableCollection<PaymentStatusType> { PaymentStatusType.PaymentFailed, PaymentStatusType.Unpaid };
Is there a way?
PS. I do actually use a SearchCriteria object for my search criteria - but I simplified for this example wondering if parameters were handled differently.