This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public IEnumerable<Person> GetPeople() | |
| { | |
| var list = new List<Person>(); | |
| // database connection/command logic removed for brevity | |
| while (reader.Read()) | |
| { | |
| var person = MapPerson(reader); | |
| list.Add(person); | |
| } | |
| return list; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| string term = "Acme"; | |
| int skip = 0; | |
| int take = 100; | |
| IVendorLookup lookup = new VendorLookup(); | |
| PagedVendorLookupResult pageOfResults = await lookup.FindByCompanyNameStartingWithAsyc(term, skip, take); | |
| pageOfResults.TotalCount.Should().Be(1); | |
| pageOfResults.VendorLookupResults[0].CompanyName.Should().Be("Acme Supply"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var config = new ConfigurationBuilder() | |
| .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) | |
| .Build(); | |
| var container = new ServiceCollection() | |
| .AddOptions() | |
| .Configure<Foo>(config.GetSection("Foo")) | |
| .BuildServiceProvider(); | |
| var options = container.GetRequiredService<IOptions<Foo>>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| float f1 = 123.453123f; | |
| double d1 = 123.453123; | |
| decimal m1 = 123.453123m; | |
| Console.WriteLine(f1 * 100.0f); | |
| Console.WriteLine(d1 * 100.0); | |
| Console.WriteLine(m1 * 100.0m); | |
| //12345.3125 | |
| //12345.312300000001 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static class Program | |
| { | |
| static void Main() | |
| { | |
| Console.WriteLine("Hello"); | |
| } | |
| } |