本文整理汇总了C#中IType.DeserializeType方法的典型用法代码示例。如果您正苦于以下问题:C# IType.DeserializeType方法的具体用法?C# IType.DeserializeType怎么用?C# IType.DeserializeType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IType
的用法示例。
在下文中一共展示了IType.DeserializeType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeserializePollingResponse
/// <summary>
/// Generates Ruby code in form of string for deserializing polling response.
/// </summary>
/// <param name="variableName">Variable name which keeps the response.</param>
/// <param name="type">Type of response.</param>
/// <returns>Ruby code in form of string for deserializing polling response.</returns>
public string DeserializePollingResponse(string variableName, IType type)
{
var builder = new IndentedStringBuilder(" ");
string serializationLogic = type.DeserializeType(this.Scope, variableName);
return builder.AppendLine(serializationLogic).ToString();
}
示例2: DeserializeProperty
/// <summary>
/// Generates code for model deserialization.
/// </summary>
/// <param name="variableName">Variable deserialize model from.</param>
/// <param name="type">The type of the model.</param>
/// <param name="isRequired">Is property required.</param>
/// <param name="defaultNamespace">The namespace.</param>
/// <returns>The code for вуserialization in string format.</returns>
public string DeserializeProperty(string variableName, IType type, bool isRequired, string defaultNamespace)
{
// TODO: handle required property via "unless deserialized_property.nil?"
var builder = new IndentedStringBuilder(" ");
// builder.AppendLine("{0} = JSON.load({0}) unless {0}.to_s.empty?", variableName);
string serializationLogic = type.DeserializeType(this.Scope, variableName, defaultNamespace);
return builder.AppendLine(serializationLogic).ToString();
}
示例3: CreateDeserializationString
public virtual string CreateDeserializationString(string inputVariable, IType type, string outputVariable, string defaultNamespace)
{
var builder = new IndentedStringBuilder(" ");
// Firstly parsing the input json file into temporay variable.
builder.AppendLine("{0} = JSON.load({1}) unless {1}.to_s.empty?", "parsed_response", inputVariable);
// Secondly parse each js object into appropriate Ruby type (DateTime, Byte array, etc.)
// and overwrite temporary variable variable value.
string deserializationLogic = type.DeserializeType(this.Scope, "parsed_response", defaultNamespace);
builder.AppendLine(deserializationLogic);
// Assigning value of temporary variable to the output variable.
return builder.AppendLine("{0} = {1}", outputVariable, "parsed_response").ToString();
}
示例4: DeserializePollingResponse
/// <summary>
/// Generates Ruby code in form of string for deserializing polling response.
/// </summary>
/// <param name="variableName">Variable name which keeps the response.</param>
/// <param name="type">Type of response.</param>
/// <param name="isRequired">If the property required.</param>
/// <param name="defaultNamespace">The namespace.</param>
/// <returns>Ruby code in form of string for deserializing polling response.</returns>
public string DeserializePollingResponse(string variableName, IType type, bool isRequired, string defaultNamespace)
{
// TODO: handle required property via "unless deserialized_property.nil?"
var builder = new IndentedStringBuilder(" ");
string serializationLogic = type.DeserializeType(this.Scope, variableName, defaultNamespace);
return builder.AppendLine(serializationLogic).ToString();
}
示例5: DeserializeProperty
/// <summary>
/// Generates code for model deserialization.
/// </summary>
/// <param name="variableName">Variable deserialize model from.</param>
/// <param name="type">The type of the model.</param>
/// <returns>The code for вуserialization in string format.</returns>
public virtual string DeserializeProperty(string variableName, IType type)
{
var builder = new IndentedStringBuilder(" ");
string serializationLogic = type.DeserializeType(this.Scope, variableName, ClassNamespaces);
return builder.AppendLine(serializationLogic).ToString();
}