Skip to content

Commit 22a2fa0

Browse files
authored
Update README.md
1 parent c631e11 commit 22a2fa0

1 file changed

Lines changed: 16 additions & 18 deletions

File tree

README.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,22 @@ A simple cross platform offline .NET library for getting Global Country Data wit
4444
foreach (var region in regions)
4545
Console.WriteLine(region.Name);
4646
```
47+
### Using lambda for custom querries
48+
#### `GetCountryData()` returns an `IEnumerable<Country>` which can be querried with Lambda for a more flexible usage.
49+
```cSharp
50+
//example1
51+
var data = helper.GetCountryData();
52+
//get list of countries by their Names
53+
var countries = data.Select(c => c.CountryName).ToList();
54+
foreach (var country in countries)
55+
Console.WriteLine(country);
56+
57+
58+
//example 2
59+
data.Where(x => x.CountryShortCode == "US")
60+
.Select(r=>r.Regions).FirstOrDefault()
61+
.ToList();
62+
```
4763

4864
### Get Country Flag
4965

@@ -303,24 +319,6 @@ A simple cross platform offline .NET library for getting Global Country Data wit
303319

304320

305321

306-
### Using lambda for custom querries
307-
#### `GetCountryData()` returns an `IEnumerable<Country>` which can be querried with Lambda for a more flexible usage.
308-
```cSharp
309-
//example1
310-
var data = helper.GetCountryData();
311-
//get list of countries by their Names
312-
var countries = data.Select(c => c.CountryName).ToList();
313-
foreach (var country in countries)
314-
Console.WriteLine(country);
315-
316-
317-
//example 2
318-
data.Where(x => x.CountryShortCode == "US")
319-
.Select(r=>r.Regions).FirstOrDefault()
320-
.ToList();
321-
```
322-
323-
324322
### Comming Soon
325323
* Support for more ISO Standard Country Data
326324
* Support for ISO 3166 Country A3 Codes

0 commit comments

Comments
 (0)