当前位置: 首页>>代码示例>>C#>>正文


C# IType.DeserializeType方法代码示例

本文整理汇总了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();
        }
开发者ID:Ranjana1996,项目名称:autorest,代码行数:13,代码来源:AzureMethodTemplateModel.cs

示例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();
        }
开发者ID:juvchan,项目名称:autorest,代码行数:19,代码来源:ModelTemplateModel.cs

示例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();
        }
开发者ID:tonytang-microsoft-com,项目名称:autorest,代码行数:15,代码来源:MethodTemplateModel.cs

示例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();
        }
开发者ID:tonytang-microsoft-com,项目名称:autorest,代码行数:17,代码来源:AzureMethodTemplateModel.cs

示例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();
        }
开发者ID:BretJohnson,项目名称:autorest,代码行数:13,代码来源:ModelTemplateModel.cs


注:本文中的IType.DeserializeType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。