Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Newtonsoft.Json;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- class Program {
- static void Main (string[] args) {
- string json = @"{
- 'Name': 'Bad Boys',
- 'ReleaseDate': '1995-4-7T00:00:00',
- 'Genres': [
- 'Action',
- 'Comedy'
- ]}";
- Movie m = JsonConvert.DeserializeObject<Movie>(json);
- string name = m.Name;
- string releaseDate = m.ReleaseDate;
- string[] genres = m.Genres;
- string x = Console.ReadLine();
- if(genres.Contains(x)) {
- Console.WriteLine(m.Name + " is a " + x + " movie");
- }
- Console.WriteLine("\n" + name + "\n" + releaseDate);
- Console.ReadLine();
- //Action
- //Comedy
- //Bad Boys
- //1995 - 4 - 7T00: 00:00
- }
- }
- public class Movie {
- public string ReleaseDate { get; set; }
- public string Name { get; set; }
- public string[] Genres { get; set; }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement