Skip to content

Commit 0cd40cc

Browse files
bnookalaBillWagner
authored andcommitted
Updating WebApiClient (#1304)
Adding missing `using` statements
1 parent 8c533ae commit 0cd40cc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

docs/csharp/tutorials/console-webapiclient.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ type to contain the information you use from this response. Let's build this slo
209209
a simple C# type that contains the name of the repository:
210210

211211
```cs
212+
using System;
213+
212214
namespace WebAPIClient
213215
{
214216
public class repo
@@ -474,9 +476,17 @@ Let's go over the new constructs above. The `IgnoreDataMember` attribute instruc
474476
that this type should not be read to or written from any JSON object. This property contains only a
475477
`get` accessor. There is no `set` accessor. That's how you define a *read only* property in C#. (Yes,
476478
you can create *write only* properties in C#, but their value is limited.) The `DateTime.ParseExact`
477-
method parses a string and creates a `DateTime` object to return. If the parse operation fails, the
479+
method parses a string and creates a `DateTime` object using a provided date format, and adds additional
480+
metadata to the `DateTime` using a `CultureInfo` object. If the parse operation fails, the
478481
property accessor throws an exception.
479482

483+
To use `CultureInfo.InvariantCulture`, you will need to add `System.Globalization` to the using statements
484+
in `repo.cs`:
485+
486+
```cs
487+
using System.Globalization;
488+
```
489+
480490
Finally, add one more output statement in the console, and you're ready to build and run this app
481491
again:
482492

0 commit comments

Comments
 (0)