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}
?可能嗎?
或任何其他解決方案!