MonoTouch.Dialog.JsonElement.LoadDateTime C# (CSharp) Method

LoadDateTime() static private method

static private LoadDateTime ( System.Json.JsonObject json, string type ) : Element
json System.Json.JsonObject
type string
return Element
		static Element LoadDateTime (JsonObject json, string type)
		{
			var caption = GetString (json, "caption");
			var date = GetString (json, "value");
			DateTime datetime;

			if (!DateTime.TryParse (date, out datetime))
				return null;

			switch (type){
			case "date":
				return new DateElement (caption, datetime);

			case "time":
				return new TimeElement (caption, datetime);

			case "datetime":
				return new DateTimeElement (caption, datetime);

			default:
				return null;
			}
		}