Streamer.JSONObject.HasProperty C# (CSharp) Method

HasProperty() public method

public HasProperty ( string prop ) : bool
prop string
return bool
		public bool HasProperty( string prop )
		{
			return keys.Contains ( prop );
		}
		

Usage Example

Esempio n. 1
0
        // process all tweets in tweetStringQueue
        void Parse()
        {
            while (true)
            {
                while (!isParsingPaused && tweetStringQueue.Count > 0)
                {
                    string newTweetStr = tweetStringQueue.Dequeue();

                    try
                    {
                        JSONObject newObj = new JSONObject(newTweetStr);

                        if (newObj.HasProperty("text"))
                        {
                            Tweet newTweet = new Tweet(newObj);
                            tweets.Enqueue(newTweet);
                        }
                        else if (newObj.HasProperty("limit"))
                        {
                            curLimit = newObj.GetProperty("limit").GetProperty("track").n;
                        }
                        else
                        {
                            Console.WriteLine("Unrecognised (valid) JSON object in stream");
                        }
                    }
                    catch
                    {
                        Console.WriteLine("Invalid object in json string");
                    }
                }

                Thread.Sleep(100);
            }
        }
All Usage Examples Of Streamer.JSONObject::HasProperty