Reputation: 24083
Can I use such webservice:
[WebMethod]
public void SetFieldValue(IFieldValue fieldValue, long itemId)
{
fieldValue.SetValue(itemId);
}
Where IFieldValue is an interface? if so - how can I determine the instance type in the client? if I cannot use this in webservice, should I create 4 different webservices that does the same (I have 4 implements of IFieldValue)?
Update: My problem is that I have a webservice that stores an item. Item has fields and is declared as:
class Item {
IField[] fields{get;set;}
more properties and methods
}
Upvotes: 3
Views: 1179
Reputation: 583
I think you should visit this topic too, Web Service Can't Serialize an Interface
Upvotes: 0
Reputation: 3769
The answer is no. If you are able to, try an abstract base class instead of an interface - that should serialize correctly, and may be suitable for your requirements.
Upvotes: 1