共用方式為


QueryStringConverter.ConvertValueToString(Object, Type) 方法

定義

將參數轉換成查詢字串表示。

public:
 virtual System::String ^ ConvertValueToString(System::Object ^ parameter, Type ^ parameterType);
public virtual string ConvertValueToString (object parameter, Type parameterType);
abstract member ConvertValueToString : obj * Type -> string
override this.ConvertValueToString : obj * Type -> string
Public Overridable Function ConvertValueToString (parameter As Object, parameterType As Type) As String

參數

parameter
Object

要轉換的參數。

parameterType
Type

要轉換之參數的 Type

傳回

String

參數名稱和值。

範例

下列程式碼會示範如何將具型別的值轉換為值的字串表示。

int value = 321;
string strValue = converter.ConvertValueToString(value, typeof(Int32));
Console.WriteLine("the value = {0}, the string representation of the value = {1}", value, strValue);
Dim value As Integer = 321
Dim strValue As String = converter.ConvertValueToString(value, GetType(Int32))
Console.WriteLine("the value = {0}, the string representation of the value = {1}", value, strValue)

適用於