I have a web service that is used to manage various "events" that occur in a live telephony system.
The method I am working on really needs to accept two arguments.
- The type of event
- Some arguments
The "some arguments" is a number of key/value pairs.
The web service is going to be called from other languages - not just .NET languages.
What should my method signature look like...
public bool Notify(string eventType, IEnumerable<KeyValuePair<string, string> argu开发者_开发技巧ments)
Or...
public bool Notify(string eventType, IDictionary<string, string> arguments)
Or something else.
I would stay away from interfaces when defining data contracts. Maybe something like this:
public bool Notify(string eventType, KeyValuePair<string, string>[] arguments)
{
}
Or define a custom class:
public class Argument
{
public string Name { get; set; }
public string Value { get; set; }
}
and then:
public bool Notify(string eventType, Argument[] arguments)
{
}
精彩评论