aboutsummaryrefslogtreecommitdiff
path: root/test/dotnet/projects/net5.0
diff options
context:
space:
mode:
Diffstat (limited to 'test/dotnet/projects/net5.0')
-rw-r--r--test/dotnet/projects/net5.0/Program.cs32
-rw-r--r--test/dotnet/projects/net5.0/example_project.csproj13
2 files changed, 45 insertions, 0 deletions
diff --git a/test/dotnet/projects/net5.0/Program.cs b/test/dotnet/projects/net5.0/Program.cs
new file mode 100644
index 0000000..3f3144f
--- /dev/null
+++ b/test/dotnet/projects/net5.0/Program.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using Newtonsoft.Json;
+
+string json = @"{
+ ""Name"": ""Inception"",
+ ""ReleaseDate"": ""2010-07-08T00:00:00"",
+ ""Genres"": [
+ ""Action"",
+ ""Thriller""
+ ]
+}";
+
+Movie? m = JsonConvert.DeserializeObject<Movie>(json);
+
+if (m == default)
+{
+ Console.WriteLine("Decoding failed!");
+}
+else
+{
+ Console.WriteLine($"Movie name: {m.Name}");
+ Console.WriteLine($"Release Date: {m.ReleaseDate}");
+ Console.WriteLine($"Genres: {string.Join(", ", m.Genres)}");
+}
+
+class Movie
+{
+ public string Name { get; set; } = "Default Name";
+ public DateTime ReleaseDate { get; set; }
+ public List<string> Genres { get; set; } = new List<string>();
+}
diff --git a/test/dotnet/projects/net5.0/example_project.csproj b/test/dotnet/projects/net5.0/example_project.csproj
new file mode 100644
index 0000000..63450c3
--- /dev/null
+++ b/test/dotnet/projects/net5.0/example_project.csproj
@@ -0,0 +1,13 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>net5.0</TargetFramework>
+ <Nullable>enable</Nullable>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
+ </ItemGroup>
+
+</Project> \ No newline at end of file