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


C# JsonWriter.WriteMember方法代码示例

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


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

示例1: ExportDataSet

        private static void ExportDataSet(ExportContext context, DataSet dataSet, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(dataSet != null);
            Debug.Assert(writer != null);

            writer.WriteStartObject();
    
            foreach (DataTable table in dataSet.Tables)
            {
                writer.WriteMember(table.TableName);

                //
                // If there is an exporter (perhaps an override) for the 
                // DataTable in effect then use it. Otherwise our 
                // DataTableExporter.
                //

                IExporter tableExporter = context.FindExporter(table.GetType());
                
                if (tableExporter != null)
                    tableExporter.Export(context, table, writer);
                else
                    DataTableExporter.ExportTable(context, table, writer);
            }
    
            writer.WriteEndObject();
        }
开发者ID:RyanWangTHU,项目名称:ccv2,代码行数:28,代码来源:DataSetExporter.cs

示例2: ExportValue

        protected override void ExportValue(ExportContext context, object value, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(value != null);
            Debug.Assert(writer != null);
            
            if (_properties.Count == 0)
            {
                writer.WriteString(value.ToString());
            }
            else
            {
                writer.WriteStartObject();

                foreach (PropertyDescriptor property in _properties)
                {
                    object propertyValue = property.GetValue(value);
                
                    if (!JsonNull.LogicallyEquals(propertyValue))
                    {
                        writer.WriteMember(property.Name);
                        context.Export(propertyValue, writer);
                    }
                }

                writer.WriteEndObject();
            }
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:28,代码来源:ComponentExporter.cs

示例3: FormatOther

        protected override void FormatOther(object o, JsonWriter writer)
        {
            if (writer == null)
                throw new ArgumentNullException("writer");

            if (JNull.LogicallyEquals(o))
            {
                FormatNull(o, writer);
                return;
            }

            writer.WriteStartObject();

            if (_properties == null)
                _properties = TypeDescriptor.GetProperties(o);

            foreach (PropertyDescriptor property in _properties)
            {
                // TODO: Allow someone to indicate via an attribute (e.g. JsonIgnore) that a property should be excluded.

                object value = property.GetValue(o);
                
                if (!JNull.LogicallyEquals(value))
                {
                    writer.WriteMember(property.Name);
                    writer.WriteValue(value);
                }
            }

            writer.WriteEndObject();
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:31,代码来源:ComponentFormatter.cs

示例4: Write

 static void Write(JsonWriter json)
 {
     json.WriteObjectStart();
     json.WriteAttribute("age", 30);
     json.WriteAttribute("first", "John");
     json.WriteAttribute("last", "Smith");
     json.WriteMember("phoneNumbers");
     json.WriteArrayStart();
     json.WriteString("425-000-1212");
     json.WriteString("425-000-1213");
     json.WriteArrayEnd();
     json.WriteMember("address");
     json.WriteObjectStart();
     json.WriteAttribute("street", "1 Microsoft Way");
     json.WriteAttribute("city", "Redmond");
     json.WriteAttribute("zip", 98052);
     json.WriteObjectEnd();
     json.WriteObjectEnd();
 }
开发者ID:TerabyteX,项目名称:corefxlab,代码行数:19,代码来源:JsonWriterTests.cs

示例5: FormatTable

        internal static void FormatTable(DataTable table, JsonWriter writer)
        {
            Debug.Assert(table != null);
            Debug.Assert(writer != null);

            writer.WriteStartObject();
            
            writer.WriteMember("rows");
            writer.WriteValue(table.Rows);

            writer.WriteEndObject();
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:12,代码来源:DataTableFormatter.cs

示例6: FormatRowView

     private static void FormatRowView(DataRowView rowView, JsonWriter writer)
     {
         writer.WriteStartObject();
 
         foreach (DataColumn column in rowView.DataView.Table.Columns)
         {
             writer.WriteMember(column.ColumnName);
             writer.WriteValue(rowView[column.Ordinal]);
         }
 
         writer.WriteEndObject();
     }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:12,代码来源:DataRowViewFormatter.cs

示例7: ExportMembers

        private static void ExportMembers(ExportContext context, IEnumerable<KeyValuePair<string, object>> members, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(members != null);
            Debug.Assert(writer != null);

            foreach (var member in members)
            {
                writer.WriteMember(member.Key);
                context.Export(member.Value, writer);
            }
        }
开发者ID:db48x,项目名称:KeeFox,代码行数:12,代码来源:ExpandoObjectExporter.cs

示例8: FormatDataSet

     private static void FormatDataSet(DataSet dataSet, JsonWriter writer)
     {
         writer.WriteStartObject();
 
         foreach (DataTable table in dataSet.Tables)
         {
             writer.WriteMember(table.TableName);
             DataTableFormatter.FormatTable(table, writer);
         }
 
         writer.WriteEndObject();
     }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:12,代码来源:DataSetFormatter.cs

示例9: ExportValue

        protected override void ExportValue(ExportContext context, object value, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(value != null);
            Debug.Assert(writer != null);
            
            if (_properties.Count == 0)
            {
                writer.WriteString(value.ToString());
            }
            else
            {
                ObjectReferenceTracker tracker = null;
                
                try
                {
                    writer.WriteStartObject();

                    foreach (PropertyDescriptor property in _properties)
                    {
                        object propertyValue = property.GetValue(value);
                
                        if (!JsonNull.LogicallyEquals(propertyValue))
                        {
                            writer.WriteMember(property.Name);

                            if (tracker == null)
                            {
                                //
                                // We are about to enter a deeper scope so 
                                // start tracking the current object being 
                                // exported. This will help to detect 
                                // recursive references that may occur 
                                // through this exporter deeper in the tree.
                                //
                                
                                tracker = TrackObject(context, value);
                            }

                            context.Export(propertyValue, writer);
                        }
                    }

                    writer.WriteEndObject();
                }
                finally
                {
                    if (tracker != null)
                        tracker.Pop(value);
                }
            }
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:52,代码来源:ComponentExporter.cs

示例10: ExportValue

 protected override void ExportValue(object value, JsonWriter writer)
 {
     writer.WriteStartObject();
     
     IDictionary dictionary = (IDictionary) value;
     
     foreach (DictionaryEntry entry in dictionary)
     {
         writer.WriteMember(entry.Key.ToString());
         writer.WriteValue(entry.Value);
     }
     
     writer.WriteEndObject();
 }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:14,代码来源:DictionaryExporter.cs

示例11: FormatView

        internal static void FormatView(DataView view, JsonWriter writer)
        {
            Debug.Assert(view != null);
            Debug.Assert(writer != null);

            writer.WriteStartObject();

            writer.WriteMember("columns");

            writer.WriteStartArray();
            foreach (DataColumn column in view.Table.Columns)
                writer.WriteValue(column.ColumnName);
            writer.WriteEndArray();

            writer.WriteMember("rows");

            writer.WriteStartArray();
            foreach (DataRowView row in view)
                writer.WriteValue(row.Row.ItemArray);
            writer.WriteEndArray();

            writer.WriteEndObject();
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:23,代码来源:DataViewFormatter.cs

示例12: ExportDataSet

        private static void ExportDataSet(DataSet dataSet, JsonWriter writer)
        {
            Debug.Assert(dataSet != null);
            Debug.Assert(writer != null);

            writer.WriteStartObject();
    
            foreach (DataTable table in dataSet.Tables)
            {
                writer.WriteMember(table.TableName);
                DataTableExporter.ExportTable(table, writer);
            }
    
            writer.WriteEndObject();
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:15,代码来源:DataSetExporter.cs

示例13: ExportView

        internal static void ExportView(ExportContext context, DataView view, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(view != null);
            Debug.Assert(writer != null);

            writer.WriteStartObject();

            writer.WriteMember("columns");

            writer.WriteStartArray();
            foreach (DataColumn column in view.Table.Columns)
                context.Export(column.ColumnName, writer);
            writer.WriteEndArray();

            writer.WriteMember("rows");

            writer.WriteStartArray();
            foreach (DataRowView row in view)
                context.Export(row.Row.ItemArray, writer);
            writer.WriteEndArray();

            writer.WriteEndObject();
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:24,代码来源:DataViewExporter.cs

示例14: FormatDataRow

        internal static void FormatDataRow(DataRow row, JsonWriter writer)
        {
            Debug.Assert(row != null);
            Debug.Assert(writer != null);

            writer.WriteStartObject();
    
            foreach (DataColumn column in row.Table.Columns)
            {
                writer.WriteMember(column.ColumnName);
                writer.WriteValue(row[column]);
            }
    
            writer.WriteEndObject();
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:15,代码来源:DataRowFormatter.cs

示例15: ExportRow

        internal static void ExportRow(ExportContext context, DataRow row, JsonWriter writer)
        {
            Debug.Assert(context != null);
            Debug.Assert(row != null);
            Debug.Assert(writer != null);

            writer.WriteStartObject();
    
            foreach (DataColumn column in row.Table.Columns)
            {
                writer.WriteMember(column.ColumnName);
                context.Export(row[column], writer);
            }
    
            writer.WriteEndObject();
        }
开发者ID:BackupTheBerlios,项目名称:jayrock-svn,代码行数:16,代码来源:DataRowExporter.cs


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