JsonQueryStringConverter.ConvertValueToString(Object, Type) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Serializes a Common Language Runtime (CLR) parameter type to a JavaScript Object Notation (JSON) representation.
public:
override System::String ^ ConvertValueToString(System::Object ^ parameter, Type ^ parameterType);
public override string ConvertValueToString (object parameter, Type parameterType);
override this.ConvertValueToString : obj * Type -> string
Public Overrides Function ConvertValueToString (parameter As Object, parameterType As Type) As String
Parameters
- parameter
- Object
The parameter value to convert.
Returns
The JSON query string parameter serialization of the CLR type. null
is returned if the parameter is null
.
Examples
Consider the following operation.
[WebGet]
[OperationContract] public int GetOptionQuote(string ticker, DateTime dte, Option opt);
This operation produces a URL that is a URL-encoded version of the following.
http://localhost/quote.svc/GetOptionQuote?ticker="MSFT"&dte="\/Date(50067823)\/"&opt={"type":"call","strikePrice":"35"}
Remarks
The converter overrides ConvertValueToString(Object, Type) so that each parameter is serialized to JSON using the default DataContractJsonSerializer and a JSON XML Writer configured to use the UTF-8 encoding. Unlike its base type, this converter can handle any type adhering to the Data Contract model.
Applies to
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기