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


C# Newtonsoft.WritePropertyName方法代码示例

本文整理汇总了C#中Newtonsoft.WritePropertyName方法的典型用法代码示例。如果您正苦于以下问题:C# Newtonsoft.WritePropertyName方法的具体用法?C# Newtonsoft.WritePropertyName怎么用?C# Newtonsoft.WritePropertyName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Newtonsoft的用法示例。


在下文中一共展示了Newtonsoft.WritePropertyName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WriteKeys

        protected override void WriteKeys(Newtonsoft.Json.JsonWriter writer)
        {
            if (CurrencyCode != null)
            {
                writer.WritePropertyName("currencyCode");
                writer.WriteValue(CurrencyCode);
            }

            if (NumberStyle != FieldNumberStyle.Unspecified)
            {
                writer.WritePropertyName("numberStyle");
                writer.WriteValue(NumberStyle.ToString());
            }
        }
开发者ID:Harleyd210,项目名称:dotnet-passbook,代码行数:14,代码来源:NumberField.cs

示例2: WriteProperties

        protected override void WriteProperties(Newtonsoft.Json.JsonTextWriter writer)
        {
            base.WriteProperties(writer);

            writer.WritePropertyName("size");
            writer.WriteValue(this.size);
        }
开发者ID:thirumg,项目名称:Avro.NET,代码行数:7,代码来源:FixedSchema.cs

示例3: WriteProperties

 protected override void WriteProperties(Newtonsoft.Json.JsonTextWriter writer)
 {
     if (null != this.itemSchema)
     {
         writer.WritePropertyName("items");
         this.itemSchema.writeJson(writer);
     }
 }
开发者ID:thirumg,项目名称:Avro.NET,代码行数:8,代码来源:ArraySchema.cs

示例4: WriteJson

        /// <summary>
        /// Writes the JSON representation of the object.
        /// </summary>
        public override void WriteJson( Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer )
        {
            var catEntry = value as CatalogEntry;
            if( catEntry != null )
            {
                writer.WriteStartObject();
                writer.WritePropertyName( "key" );
                writer.WriteValue( catEntry.Key );

                if( catEntry.Attributes.Length > 0 )
                {
                    writer.WritePropertyName( "attributes" );
                    serializer.Serialize( writer, catEntry.Attributes );
                }
                writer.WriteEndObject();
            }
        }
开发者ID:darksun190,项目名称:PiWeb-Api,代码行数:20,代码来源:CatalogueEntryConverter.cs

示例5: WriteKeys

        protected override void WriteKeys(Newtonsoft.Json.JsonWriter writer)
        {
            if (DateStyle != FieldDateTimeStyle.Unspecified)
            {
                writer.WritePropertyName("dateStyle");
                writer.WriteValue(DateStyle.ToString());
            }

            if (TimeStyle != FieldDateTimeStyle.Unspecified)
            {
                writer.WritePropertyName("timeStyle");
                writer.WriteValue(TimeStyle.ToString());
            }

            writer.WritePropertyName("isRelative");
            writer.WriteValue(IsRelative);
        }
开发者ID:scottcate,项目名称:dotnet-passbook,代码行数:17,代码来源:DateField.cs

示例6: WriteJson

        public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value)
        {
            CommentCollection c = value as CommentCollection;
            if (c != null)
            {
                writer.WriteStartObject();
                writer.WritePropertyName("Page");
                writer.WriteValue(c.PageNumber);
                writer.WritePropertyName("PageCount");
                writer.WriteValue(c.Pages);
                writer.WritePropertyName("PostLink");
                writer.WriteValue(c.PostLink);

                writer.WritePropertyName("Comments");
                base.WriteJson(writer, value);
                writer.WriteEndObject();
            }
        }
开发者ID:mrkurt,项目名称:mubble-old,代码行数:18,代码来源:CommentCollectionConverter.cs

示例7: WriteJson

 public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, JsonSerializer serializer)
 {
     ConfigItemCollection items = (ConfigItemCollection)value;
     
     if (value != null && items.Count > 0)
     {
         foreach (ConfigItem item in items)
         {
             writer.WritePropertyName(items.CamelName ? Ext.Net.Utilities.StringUtils.ToLowerCamelCase(item.Name) : item.Name);
             writer.WriteRawValue(item.ValueToString());
         }
     }
 }
开发者ID:emayk,项目名称:Ext.NET.Pro,代码行数:13,代码来源:CustomConfigJsonConverter.cs

示例8: WriteJson

        public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, JsonSerializer serializer)
        {
            DynamicConfigDictionary config = (DynamicConfigDictionary)value;

            if (config != null)
            {
                var keys = config.GetDynamicMemberNames();  
                
                foreach (string key in keys)
                {
                    writer.WritePropertyName(Ext.Net.Utilities.StringUtils.ToLowerCamelCase(key));
                    writer.WriteRawValue(JSON.Serialize(config.GetDynamicValue(key), new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()));
                }
            }
        }
开发者ID:rajjan,项目名称:Ext.NET.Community,代码行数:15,代码来源:ConfigBagJsonConverter.cs

示例9: WriteValue

        public override void WriteValue(object Value, Newtonsoft.Json.JsonWriter Writer, MudObject Owner)
        {
            var contents = Value as Dictionary<String, Object>;
            if (contents == null) throw new InvalidOperationException();

            Writer.WriteStartObject();

            foreach (var pair in contents)
            {
                Writer.WritePropertyName(pair.Key);
                PersistAttribute._WriteValue(pair.Value, Writer, Owner);
            }

            Writer.WriteEndObject();
        }
开发者ID:Reddit-Mud,项目名称:RMUD,代码行数:15,代码来源:DictionaryStringObjectSerializer.cs

示例10: WriteJson

        /// <summary>
        /// Writes the JSON representation of the object.
        /// </summary>
        public override void WriteJson( Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer )
        {
            var attribute = value as DataService.Attribute;
            if( attribute != null )
            {
                writer.WritePropertyName( attribute.Key.ToString( System.Globalization.CultureInfo.InvariantCulture ) );
                writer.WriteValue( attribute.Value );
            }
            else
            {
                writer.WriteStartObject();

                var attributes = (DataService.Attribute[])value;
                if( attributes != null && attributes.Length > 0 )
                {
                    foreach( var att in attributes )
                    {
                        writer.WritePropertyName( att.Key.ToString( System.Globalization.CultureInfo.InvariantCulture ) );
                        writer.WriteValue( att.Value );
                    }
                }
                writer.WriteEndObject();
            }
        }
开发者ID:darksun190,项目名称:PiWeb-Api,代码行数:27,代码来源:AttributeConverter.cs

示例11: WriteValue

        public override void WriteValue(object Value, Newtonsoft.Json.JsonWriter Writer, MudObject Owner)
        {
            var contents = Value as Dictionary<RelativeLocations, List<MudObject>>;
            if (contents == null) throw new InvalidOperationException();

            Writer.WriteStartObject();

            foreach (var relloc in contents)
            {
                Writer.WritePropertyName(RelativeLocationToString(relloc.Key));
                Writer.WriteStartArray();

                foreach (var mudObject in relloc.Value.Where(o => o.IsNamedObject && o.IsInstance))
                    Writer.WriteValue(mudObject.GetFullName());

                Writer.WriteEndArray();
            }

            Writer.WriteEndObject();
        }
开发者ID:Reddit-Mud,项目名称:RMUD,代码行数:20,代码来源:ContainerSerializer.cs

示例12: WriteJson

        /// <summary>
        /// Writes the JSON representation of the object.
        /// </summary>
        public override void WriteJson( Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer )
        {
            var catalog = (Catalog)value;
            if( catalog.Uuid != Guid.Empty )
            {
                writer.WriteStartObject();

                writer.WritePropertyName( "uuid" );
                writer.WriteValue( catalog.Uuid );

                if( !String.IsNullOrEmpty( catalog.Name ) )
                {
                    writer.WritePropertyName( "name" );
                    writer.WriteValue( catalog.Name );
                }

                if( catalog.ValidAttributes.Length > 0 )
                {
                    writer.WritePropertyName( "validAttributes" );
                    writer.WriteStartArray();
                    foreach( var att in catalog.ValidAttributes )
                    {
                        writer.WriteValue( att );
                    }
                    writer.WriteEndArray();
                }

                if( catalog.CatalogEntries.Length > 0 )
                {
                    writer.WritePropertyName( "catalogEntries" );
                    serializer.Serialize( writer, catalog.CatalogEntries );
                }

                writer.WriteEndObject();
            }
        }
开发者ID:darksun190,项目名称:PiWeb-Api,代码行数:39,代码来源:CatalogConverter.cs

示例13: SerializeNode

        private void SerializeNode(Newtonsoft.Json.JsonWriter writer, IXmlNode node, XmlNamespaceManager manager, bool writePropertyName)
        {
            switch (node.NodeType)
            {
                case XmlNodeType.Document:
                case XmlNodeType.DocumentFragment:
                    SerializeGroupedNodes(writer, node, manager, writePropertyName);
                    break;
                case XmlNodeType.Element:
                    if (IsArray(node) && node.ChildNodes.All(n => n.LocalName == node.LocalName) && node.ChildNodes.Count > 0)
                    {
                        SerializeGroupedNodes(writer, node, manager, false);
                    }
                    else
                    {
                        manager.PushScope();
                        
                        foreach (IXmlNode attribute in node.Attributes)
                        {
                            if (attribute.NamespaceUri == "http://www.w3.org/2000/xmlns/")
                            {
                                string namespacePrefix = (attribute.LocalName != "xmlns")
                                                         ? attribute.LocalName
                                                         : string.Empty;
                                string namespaceUri = attribute.Value;
                                
                                manager.AddNamespace(namespacePrefix, namespaceUri);
                            }
                        }
                        
                        if (writePropertyName)
                            writer.WritePropertyName(GetPropertyName(node, manager));
                        
                        if (!ValueAttributes(node.Attributes).Any() && node.ChildNodes.Count == 1 &&
                            node.ChildNodes[0].NodeType == XmlNodeType.Text)
                        {
                            // write elements with a single text child as a name value pair
                            writer.WriteValue(node.ChildNodes[0].Value);
                        }
                        else if (node.ChildNodes.Count == 0 && CollectionUtils.IsNullOrEmpty(node.Attributes))
                        {
                            IXmlElement element = (IXmlElement)node;
                            
                            // empty element
                            if (element.IsEmpty)
                                writer.WriteNull();
                            else
                                writer.WriteValue(string.Empty);
                        }
                        else
                        {
                            writer.WriteStartObject();
                            
                            for (int i = 0; i < node.Attributes.Count; i++)
                            {
                                SerializeNode(writer, node.Attributes[i], manager, true);
                            }
                            
                            SerializeGroupedNodes(writer, node, manager, true);

                            writer.WriteEndObject();
                        }
                        
                        manager.PopScope();
                    }
                    
                    break;
                case XmlNodeType.Comment:
                    if (writePropertyName)
                        writer.WriteComment(node.Value);
                    break;
                case XmlNodeType.Attribute:
                case XmlNodeType.Text:
                case XmlNodeType.CDATA:
                case XmlNodeType.ProcessingInstruction:
                case XmlNodeType.Whitespace:
                case XmlNodeType.SignificantWhitespace:
                    if (node.NamespaceUri == "http://www.w3.org/2000/xmlns/" && node.Value == JsonNamespaceUri)
                        return;

                    if (node.NamespaceUri == JsonNamespaceUri)
                    {
                        if (node.LocalName == "Array")
                            return;
                    }
                    
                    if (writePropertyName)
                        writer.WritePropertyName(GetPropertyName(node, manager));
                    writer.WriteValue(node.Value);
                    break;
                case XmlNodeType.XmlDeclaration:
                    IXmlDeclaration declaration = (IXmlDeclaration)node;
                    writer.WritePropertyName(GetPropertyName(node, manager));
                    writer.WriteStartObject();
                    
                    if (!string.IsNullOrEmpty(declaration.Version))
                    {
                        writer.WritePropertyName("@version");
                        writer.WriteValue(declaration.Version);
                    }
//.........这里部分代码省略.........
开发者ID:HaKDMoDz,项目名称:eStd,代码行数:101,代码来源:XmlNodeConverter.cs

示例14: writeJson

        internal void writeJson(Newtonsoft.Json.JsonTextWriter writer)
        {
            writer.WriteStartObject();
            //JsonHelper.writeIfNotNullOrEmpty(writer, "name", this.Name);
            JsonHelper.writeIfNotNullOrEmpty(writer, "doc", this.Doc);

            if (null != this.Request)
            {
                writer.WritePropertyName("request");
                writer.WriteStartArray();

                foreach (Parameter parameter in this.Request)
                {
                    System.Diagnostics.Debug.Assert(parameter != null);
                    parameter.writeJson(writer);
                }

                writer.WriteEndArray();
            }

            if (null != this.Response)
            {
                writer.WritePropertyName("response");
                this.Response.writeJson(writer);
            }

            if (null != this.Error)
            {
                writer.WritePropertyName("errors");
                this.Error.writeJson(writer);
            }


            writer.WriteEndObject();
        }
开发者ID:thirumg,项目名称:Avro.NET,代码行数:35,代码来源:Message.cs

示例15: WriteJson

 public void WriteJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WritePropertyName(Name);
     writer.WriteValue(Function);
 }
开发者ID:kolosy,项目名称:LoveSeat,代码行数:5,代码来源:GenericDesignDocument.cs


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