I have an interface for a message:
public interface IMessage
{
int Id { get; set; }
string Body { get; set; }
string Title { get; set; }
Employee CreatedBy { get; set; }
MessageType MessageType { get; set; }
void Send(IEnumerable<User> recipients);
// or: void Send(User recipient);
}
Every implementation must have a Send method that sends the message, but depending on the scenario the Send method is different. I.e. if it is a private message, there is only one recipient and it is also sent an additional mail notification to that spesific user, public messages does not do that.
The parameter can be either a list of users or a single user. How can I implement that?
I know I can just make a list of 1 user for the private message, but the best is if it is like an overloaded method.
You could also mark it with params
in which case you can pass in one, many or an array of Users.