當前位置: 首頁>>代碼示例>>C#>>正文


C# JsonWriter.WriteProperty方法代碼示例

本文整理匯總了C#中Newtonsoft.Json.JsonWriter.WriteProperty方法的典型用法代碼示例。如果您正苦於以下問題:C# JsonWriter.WriteProperty方法的具體用法?C# JsonWriter.WriteProperty怎麽用?C# JsonWriter.WriteProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Newtonsoft.Json.JsonWriter的用法示例。


在下文中一共展示了JsonWriter.WriteProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: WriteJson

        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var push = value as PushNotification;
            if (push == null)
            {
                writer.WriteNull();
                return;
            }

            writer.StartObject();
            // Write push type
            if (string.IsNullOrWhiteSpace(push.Query) == false)
                writer.WriteProperty("query", push.Query);
            else if( push.Channels.Count() > 0 )
                writer.WriteArray("channels", push.Channels);
            else if( push.DeviceIds.Count() > 0 )
                writer.WriteArray("deviceids", push.DeviceIds);
            else
                writer.WriteProperty("broadcast", true);
            // Write data
            WriteData(writer, push);
            // Write platform options
            WritePlatformOptions(writer, push.PlatformOptions);
            writer.EndObject();

        }
開發者ID:neilunadkat,項目名稱:appacitive-dotnet-sdk,代碼行數:26,代碼來源:PushNotificationConverter.cs

示例2: WriteJson

 public override void WriteJson(JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WriteProperty("mod", Module);
     writer.WriteProperty("fun", Function);
     writer.WriteEndObject();
 }
開發者ID:remotex,項目名稱:CorrugatedIron,代碼行數:7,代碼來源:RiakErlangCommitHook.cs

示例3: WriteJson

 // Writes JSON representaion of the method to the specified JsonWriter.
 // Used to generate Ext.Direct API
 internal void WriteJson(JsonWriter jsonWriter)
 {
     jsonWriter.WriteStartObject();
     jsonWriter.WriteProperty("name", this.Name);
     jsonWriter.WriteProperty("len", this.Len);
     if (this.IsFormHandler) {
         jsonWriter.WriteProperty("formHandler", true);
     }
     jsonWriter.WriteEndObject();
 }
開發者ID:xcrash,項目名稱:ext-direct-mvc,代碼行數:12,代碼來源:DirectMethod.cs

示例4: WriteFieldValueFactor

		private bool WriteFieldValueFactor(JsonWriter writer, IFieldValueFactorFunction value, JsonSerializer serializer)
		{
			if (value == null) return false;
			writer.WritePropertyName("field_value_factor");
			writer.WriteStartObject();
			{
				writer.WriteProperty(serializer, "field", value.Field);
				writer.WriteProperty(serializer, "factor", value.Factor);
				writer.WriteProperty(serializer, "missing", value.Missing);
				writer.WriteProperty(serializer, "modifier", value.Modifier);
			}
			writer.WriteEndObject();
			return true;
		}
開發者ID:RossLieberman,項目名稱:NEST,代碼行數:14,代碼來源:ScoreFunctionJsonConverter.cs

示例5: WriteJson

        protected override void WriteJson(Entity entity, JsonWriter writer, JsonSerializer serializer)
        {
            var conn = entity as Connection;
            if (conn == null)
                return;

            
            // Write endpoint A
            if (conn.CreateEndpointA == false)
            {
                writer
                    .WriteProperty("__endpointa")
                    .StartObject()
                    .WriteProperty("label", conn.EndpointA.Label)
                    .WriteProperty("articleid", conn.EndpointA.ArticleId)
                    .EndObject();
            }
            else
            {
                writer
                    .WriteProperty("__endpointa")
                    .StartObject()
                    .WriteProperty("label", conn.EndpointA.Label)
                    .WriteProperty("article")
                    .WithWriter( w => WriteArticle(w, conn.EndpointA.Content) )
                    .EndObject();
            }

            // Write endpoint B
            if (conn.CreateEndpointB == false)
            {
                writer
                    .WriteProperty("__endpointb")
                    .StartObject()
                    .WriteProperty("label", conn.EndpointB.Label)
                    .WriteProperty("articleid", conn.EndpointB.ArticleId)
                    .EndObject();
            }
            else
            {
                writer
                    .WriteProperty("__endpointb")
                    .StartObject()
                    .WriteProperty("label", conn.EndpointB.Label)
                    .WriteProperty("article")
                    .WithWriter(w => WriteArticle(w, conn.EndpointB.Content))
                    .EndObject();
            }
        }
開發者ID:beer-bahadur,項目名稱:appacitive-dotnet-sdk,代碼行數:49,代碼來源:ConnectionConverter.cs

示例6: WriteJson

        public void WriteJson(JsonWriter writer) {
            writer.WriteStartObject();
            writer.WriteProperty("name", Name);

            if (Params != null) {
                writer.WriteProperty("params", Params);
            } else {
                writer.WriteProperty("len", Len);
            }

            if (IsFormHandler) {
                writer.WriteProperty("formHandler", true);
            }

            writer.WriteEndObject();
        }
開發者ID:taskeenkayani,項目名稱:ext-direct-mvc,代碼行數:16,代碼來源:DirectMethod.cs

示例7: Serialize

        public void Serialize(JsonWriter writer, object obj, JsonSerializer serializer)
        {
            if (obj == null) return;

            var issue = (Issue) obj;

            writer.WriteStartObject();
            writer.WriteValue(RedmineKeys.ISSUE);

            writer.WriteProperty(RedmineKeys.SUBJECT, issue.Subject);
            writer.WriteProperty(RedmineKeys.DESCRIPTION, issue.Description);
            writer.WriteProperty(RedmineKeys.NOTES, issue.Notes);

            if (issue.Id != 0)
            {
                writer.WriteProperty(RedmineKeys.PRIVATE_NOTES, issue.PrivateNotes);
            }

            writer.WriteProperty(RedmineKeys.IS_PRIVATE, issue.IsPrivate);

            writer.WriteIdIfNotNull(RedmineKeys.PROJECT_ID, issue.Project);
            writer.WriteIdIfNotNull(RedmineKeys.PRIORITY_ID, issue.Priority);
            writer.WriteIdIfNotNull(RedmineKeys.STATUS_ID, issue.Status);
            writer.WriteIdIfNotNull(RedmineKeys.CATEGORY_ID, issue.Category);
            writer.WriteIdIfNotNull(RedmineKeys.TRACKER_ID, issue.Tracker);
            writer.WriteIdIfNotNull(RedmineKeys.ASSIGNED_TO_ID, issue.AssignedTo);
            writer.WriteIdIfNotNull(RedmineKeys.FIXED_VERSION_ID, issue.FixedVersion);
            writer.WriteValueOrEmpty(RedmineKeys.ESTIMATED_HOURS, issue.EstimatedHours);

            writer.WriteIdOrEmpty(RedmineKeys.PARENT_ISSUE_ID, issue.ParentIssue);
            writer.WriteDateOrEmpty(RedmineKeys.START_DATE, issue.StartDate);
            writer.WriteDateOrEmpty(RedmineKeys.DUE_DATE, issue.DueDate);
            writer.WriteDateOrEmpty(RedmineKeys.UPDATED_ON, issue.DueDate);

            if (issue.DoneRatio != null)
                writer.WriteProperty(RedmineKeys.DONE_RATIO, issue.DoneRatio.Value.ToString(CultureInfo.InvariantCulture));

            if (issue.SpentHours != null)
                writer.WriteProperty(RedmineKeys.SPENT_HOURS, issue.SpentHours.Value.ToString(CultureInfo.InvariantCulture));

            writer.WriteArray(RedmineKeys.UPLOADS, issue.Uploads, new UploadConverter(), serializer);
            writer.WriteArray(RedmineKeys.CUSTOM_FIELDS, issue.CustomFields, new IssueCustomFieldConverter(), serializer);

            writer.WriteIdsArray(RedmineKeys.WATCHER_USER_IDS, issue.Watchers);

            writer.WriteEndObject();
        }
開發者ID:Jopie64,項目名稱:redmine-net-api,代碼行數:47,代碼來源:IssueConverter.cs

示例8: WriteTileOptions

 private void WriteTileOptions(JsonWriter writer, TileNotification option)
 {
     writer.StartObject();
     writer.WriteProperty("notificationtype", "tile");
     WriteTile(writer, "wp8", option.WP8Tile);
     WriteTile(writer, "wp75", option.WP75Tile);
     WriteTile(writer, "wp7", option.WP7Tile);
     writer.EndObject();
 }
開發者ID:neilunadkat,項目名稱:appacitive-dotnet-sdk,代碼行數:9,代碼來源:PushNotificationConverter.cs

示例9: WriteJson

        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            var request = value as AtomicCountersRequest;
            if (request == null)
            {
                writer.WriteNull();
                return;
            }

            writer.WriteStartObject();
            writer.WritePropertyName(request.Property );
            writer.WriteStartObject();
            if( request.IncrementBy > 0 )
                writer.WriteProperty("incrementby", request.IncrementBy.ToString());
            if( request.DecrementBy > 0 )
                writer.WriteProperty("decrementby", request.DecrementBy.ToString());
            writer.WriteEndObject();
            writer.WriteEndObject();
        }
開發者ID:ytokas,項目名稱:appacitive-dotnet-sdk,代碼行數:19,代碼來源:AtomicCountersRequestConverter.cs

示例10: WriteWpOptions

 private void WriteWpOptions(JsonWriter writer, WindowsPhoneOptions options)
 {
     writer.WriteProperty("wp");
     if (options.Notification.WPNotificationType == WPNotificationType.Toast)
         WriteToastOptions(writer, options.Notification as ToastNotification);
     else if (options.Notification.WPNotificationType == WPNotificationType.Tile)
         WriteTileOptions(writer, options.Notification as TileNotification);
     if (options.Notification.WPNotificationType == WPNotificationType.Raw)
         WriteRawOptions(writer, options.Notification as RawNotification);
 }
開發者ID:neilunadkat,項目名稱:appacitive-dotnet-sdk,代碼行數:10,代碼來源:PushNotificationConverter.cs

示例11: Serialize

        public void Serialize(JsonWriter writer, object obj, JsonSerializer serializer)
        {
            if (obj == null) return;

            var item = (IssueCustomField)obj;

            if (item.Values == null) return;

            var count = item.Values.Count;

            if (count > 1)
            {
                writer.WriteProperty(RedmineKeys.VALUE, item.Values.Select(x => x.Info).ToArray());
            }
            else
            {
                writer.WriteProperty(RedmineKeys.VALUE, count > 0 ? item.Values[0].Info : null);
            }
        }
開發者ID:Jopie64,項目名稱:redmine-net-api,代碼行數:19,代碼來源:IssueCustomFieldConverter.cs

示例12: WriteJson

 protected override void WriteJson(Entity entity, JsonWriter writer, JsonSerializer serializer)
 {
     if (entity == null)
         return;
     var device = entity as Device;
     if (device != null)
     {
         writer
             .WriteProperty("__schemaid", device.SchemaId);
     }
 }
開發者ID:neilunadkat,項目名稱:appacitive-dotnet-sdk,代碼行數:11,代碼來源:DeviceConverter.cs

示例13: WriteRandomScore

		private bool WriteRandomScore(JsonWriter writer, IRandomScoreFunction value, JsonSerializer serializer)
		{
			if (value == null) return false;
			writer.WritePropertyName("random_score");
			writer.WriteStartObject();
			{
				writer.WriteProperty(serializer, "seed", value.Seed);
			}
			writer.WriteEndObject();
			return true;
		}
開發者ID:RossLieberman,項目名稱:NEST,代碼行數:11,代碼來源:ScoreFunctionJsonConverter.cs

示例14: WriteJson

 protected override void WriteJson(Entity entity, JsonWriter writer, JsonSerializer serializer)
 {
     if (entity == null)
         return;
     var user = entity as User;
     if (user != null)
     {
         writer
             .WriteProperty("__schemaid", user.SchemaId);
     }
 }
開發者ID:beer-bahadur,項目名稱:appacitive-dotnet-sdk,代碼行數:11,代碼來源:UserConverter.cs

示例15: WriteScriptScore

		private bool WriteScriptScore(JsonWriter writer, IScriptScoreFunction value, JsonSerializer serializer)
		{
			if (value == null) return false;
			writer.WritePropertyName("script_score");
			writer.WriteStartObject();
			{
				writer.WriteProperty(serializer, "script", value.Script);
			}
			writer.WriteEndObject();
			return true;
		}
開發者ID:RossLieberman,項目名稱:NEST,代碼行數:11,代碼來源:ScoreFunctionJsonConverter.cs


注:本文中的Newtonsoft.Json.JsonWriter.WriteProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。