VkNet.Utils.VkResponse.ContainsKey C# (CSharp) Méthode

ContainsKey() public méthode

Определяет, содержит ли JSON указанный ключ.
public ContainsKey ( string key ) : bool
key string Ключ.
Résultat bool
		public bool ContainsKey(string key)
		{
			if (!(_token is JObject))
			{
				return false;
			}

			var token = _token[key];
			return token != null;
		}

Usage Example

Exemple #1
0
		internal static Relative FromJson(VkResponse response)
		{
			var relative = new Relative();

			// Согласно документации VK API, должно возвращаться поле id, однако фактически может возвращаться uid (для старых версий API).
			// Можно будет парсить только id после перевода всех методов на более новые версии (как минимум Users.Search).
			if (response.ContainsKey("id"))
				relative.Id = response["id"];
			else if (response.ContainsKey("uid"))
				relative.Id = response["uid"];
			
			relative.Type = response["type"];
			relative.Name = response["name"];

			return relative;
		}
All Usage Examples Of VkNet.Utils.VkResponse::ContainsKey