Reputation: 5469
There's some interface:
public interface IMessage
{
string Content;
Person Sender;
}
public class Priv : IMessage
{
public string Content { get; set; }
public Person Sender { get; set; }
private int whatever;
}
public class Publ : IMessage
{
public string Content { get; set; }
public Person Sender { get; set; }
private DateTime something;
}
Is it possible to use in wcf service IMessage
instance?
Like void SomeMethod(IMessage toSend)
?
Upvotes: 2
Views: 103
Reputation: 16042
Yes, that is possible. You have to tell the Service the list of expected implementations you will send by using the KnownTypes
attribute
Upvotes: 3