本文整理汇总了C#中Jayrock.Json.JsonWriter.WriteMember方法的典型用法代码示例。如果您正苦于以下问题:C# JsonWriter.WriteMember方法的具体用法?C# JsonWriter.WriteMember怎么用?C# JsonWriter.WriteMember使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jayrock.Json.JsonWriter
的用法示例。
在下文中一共展示了JsonWriter.WriteMember方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WritePhoneNumber
private static void WritePhoneNumber(JsonWriter writer, string location, string number)
{
writer.WriteStartObject(); // {
writer.WriteMember("Location"); // "Location" :
writer.WriteString(location); // "...",
writer.WriteMember("Number"); // "Number" :
writer.WriteString(number); // "..."
writer.WriteEndObject(); // }
}
示例2: Format
public virtual void Format(JsonWriter writer)
{
writer.WriteStartObject();
foreach (string name in _nameIndexList)
{
writer.WriteMember(name);
writer.WriteValue(InnerHashtable[name]);
}
writer.WriteEndObject();
}
示例3: Export
public void Export(JsonWriter writer)
{
if (writer == null)
throw new ArgumentNullException("writer");
writer.WriteStartObject();
foreach (string name in NameIndexList)
{
writer.WriteMember(name);
writer.WriteValue(InnerHashtable[name]);
}
writer.WriteEndObject();
}
示例4: WriteRssToJson
private static void WriteRssToJson(Item item, JsonWriter writer)
{
writer.WriteStartObject();
writer.WriteMember("title");
writer.WriteString(item.title);
writer.WriteMember("description");
writer.WriteString(item.description);
writer.WriteMember("link");
writer.WriteString(item.link);
writer.WriteEndObject();
}
示例5: Export
public void Export(ExportContext context, JsonWriter writer, object source)
{
if (context == null) throw new ArgumentNullException("context");
if (writer == null) throw new ArgumentNullException("writer");
if (source == null) throw new ArgumentNullException("source");
object value = _property.GetValue(source);
if (JsonNull.LogicallyEquals(value) || value.Equals(_defaultValue))
return;
writer.WriteMember(_property.Name);
context.Export(value, writer);
}
示例6: Export
protected virtual void Export(ExportContext context, JsonWriter writer)
{
if (context == null)
throw new ArgumentNullException("context");
if (writer == null)
throw new ArgumentNullException("writer");
writer.WriteStartObject();
foreach (string name in NameIndexList)
{
writer.WriteMember(name);
context.Export(InnerHashtable[name], writer);
}
writer.WriteEndObject();
}
示例7: FormatDictionary
protected virtual void FormatDictionary(IDictionary dictionary, JsonWriter writer)
{
writer.WriteStartObject();
foreach (DictionaryEntry entry in dictionary)
{
writer.WriteMember(entry.Key.ToString());
writer.WriteValue(entry.Value);
}
writer.WriteEndObject();
}
示例8: Export
/// <summary>
/// The export.
/// </summary>
/// <param name="context">
/// The context.
/// </param>
/// <param name="value">
/// The value.
/// </param>
/// <param name="writer">
/// The writer.
/// </param>
public void Export(ExportContext context, object value, JsonWriter writer)
{
writer.WriteStartObject();
writer.WriteMember("Critter");
var critter = (Critter)value;
writer.WriteStartObject();
if (exportType > ExportType.Expanded)
{
writer.WriteMember("Age");
writer.WriteNumber(critter.Age);
writer.WriteMember("N");
writer.WriteNumber(critter.N);
}
writer.WriteMember("Rank");
writer.WriteNumber(critter.Rank);
writer.WriteMember("Fitness");
writer.WriteStartObject();
int i = 0;
foreach (var n in Enum.GetNames(typeof(FitnessParameter)))
{
writer.WriteMember(n);
writer.WriteNumber(critter.Fitness[i++]);
}
writer.WriteEndObject();
// writer.WriteMember("Fitness");
// context.Export(critter.Fitness,writer);
if (exportType > ExportType.Summary)
{
writer.WriteMember("Route");
writer.WriteStartArray();
foreach (var node in critter.Route)
{
writer.WriteNumber(node.Node.Id);
}
writer.WriteEndArray();
}
writer.WriteMember("Legs");
writer.WriteStartArray();
foreach (var leg in critter.Fitness.JourneyLegs)
{
writer.WriteStartObject();
if (exportType > ExportType.Summary)
{
writer.WriteMember("Start");
writer.WriteNumber(leg.Origin.Id);
writer.WriteMember("End");
writer.WriteNumber(leg.Destination.Id);
writer.WriteMember("Route");
writer.WriteString(leg.RouteId1);
}
if (exportType > ExportType.Simple)
{
writer.WriteMember("StartLocation");
writer.WriteStartObject();
writer.WriteMember("Lat");
writer.WriteNumber(leg.Origin.Latitude);
writer.WriteMember("Long");
writer.WriteNumber(leg.Origin.Longitude);
writer.WriteEndObject();
writer.WriteMember("EndLocation");
writer.WriteStartObject();
writer.WriteMember("Lat");
writer.WriteNumber(leg.Destination.Latitude);
writer.WriteMember("Long");
writer.WriteNumber(leg.Destination.Longitude);
writer.WriteEndObject();
}
writer.WriteMember("Mode");
writer.WriteString(leg.TransportMode.ToString());
writer.WriteMember("TotalTime");
context.Export(leg.TotalTime, writer);
writer.WriteMember("DepartTime");
context.Export(leg.DepartureTime, writer);
writer.WriteMember("OriginName");
writer.WriteString(leg.Origin.StopSpecName);
//.........这里部分代码省略.........