Skip to content

Commit 3ed1f8b

Browse files
Copilotgewarren
andcommitted
Fix VB namespace and class naming to match C# example structure
Co-authored-by: gewarren <[email protected]>
1 parent fb918d9 commit 3ed1f8b

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

docs/standard/serialization/system-text-json/snippets/how-to/vb/DeserializeExtra.vb

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
Imports System.Text.Json
22

3-
Namespace SystemTextJsonSamples
3+
Namespace DeserializeExtra
44

5-
Public NotInheritable Class DeserializeExtra
5+
Public Class WeatherForecast
6+
Public Property [Date] As DateTimeOffset
7+
Public Property TemperatureCelsius As Integer
8+
Public Property Summary As String
9+
Public SummaryField As String
10+
Public Property DatesAvailable As IList(Of DateTimeOffset)
11+
Public Property TemperatureRanges As Dictionary(Of String, HighLowTemps)
12+
Public Property SummaryWords As String()
13+
End Class
14+
15+
Public Class HighLowTemps
16+
Public Property High As Integer
17+
Public Property Low As Integer
18+
End Class
19+
20+
Public NotInheritable Class Program
621

722
Public Shared Sub Run()
823
Dim jsonString As String =
@@ -31,8 +46,8 @@ Namespace SystemTextJsonSamples
3146
]
3247
}"
3348

34-
Dim weatherForecast As WeatherForecastWithPOCOs =
35-
JsonSerializer.Deserialize(Of WeatherForecastWithPOCOs)(jsonString)
49+
Dim weatherForecast As WeatherForecast =
50+
JsonSerializer.Deserialize(Of WeatherForecast)(jsonString)
3651

3752
Console.WriteLine($"Date: {weatherForecast?.Date}")
3853
Console.WriteLine($"TemperatureCelsius: {weatherForecast?.TemperatureCelsius}")

0 commit comments

Comments
 (0)