0
我创造了这个代码:如何通过UriTemplate在一个名称中设置两个值?
[OperationContract]
[WebGet(UriTemplate = "detect?v=1.0&q={q}", BodyStyle = WebMessageBodyStyle.Bare)]
DetectLanguage GetDetectLanguage(string q);
[OperationContract]
[WebGet(UriTemplate = "translate?v=1.0&q={query}&(langpair={from}|{to})", BodyStyle = WebMessageBodyStyle.Bare)]
TranslateLanguage GetTranslateLanguage(string query, string from, string to);
但我得到这个错误:
The UriTemplate
'translate?v=1.0&q={query}&(langpair={from}|{to})'
is not valid; each portion of the query string must be of the form'name=value'
, when value cannot be a compound segment. See the documentation for UriTemplate for more details.
我知道(name=value)
。我如何获得Name={value1}|{value2}
?可能吗?
或任何其他解决方案!