https://github.com/karenpayneoregon/top-level-csharp
top-level feature for C#9
https://github.com/karenpayneoregon/top-level-csharp
csharp csharp9 toplevel
Last synced: 12 months ago
JSON representation
top-level feature for C#9
- Host: GitHub
- URL: https://github.com/karenpayneoregon/top-level-csharp
- Owner: karenpayneoregon
- Created: 2021-07-07T01:33:37.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-07-07T16:16:18.000Z (over 4 years ago)
- Last Synced: 2025-01-29T00:29:13.216Z (about 1 year ago)
- Topics: csharp, csharp9, toplevel
- Language: C#
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# About
Starting in C# 9, you don't have to explicitly include a Main method in a console application project. Instead, you can use the `top-level statements` feature to minimize the code you have to write. In this case, the compiler generates a class and Main method entry point for the application.
**See** Microsoft docs: [Top-level statements](https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/top-level-statements)
# Included projects
- `BasicConsoleApp` demonstrates a basic top-level console project
- `BasicUsingInternalClassesApp` demonstrates accessing functionality with classes in the same project.
- `BasicEntityFrameworkCoreApp` provides a simple read from a SQL-Server database using [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/)
- BasicConsoleWithLocalSwitchApp example using [switch expression](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/switch-expression)
- WorkingWithDataConsoleApp shows working with
- Class project `DataLibrary` to read json data
- Class project `ContainerLibrary` with concrete classes used in `DataLibrary`
More code samples to be added shortly.
# Requires
- [.NET Core](https://dotnet.microsoft.com/download) 5 or higher
- [Microsoft Visual Studio](https://visualstudio.microsoft.com/) 2019 or higher
- Newtonsoft.Json which can be swapped out for [System.Json](https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-how-to?pivots=dotnet-5-0)
- [SQL-Server](https://www.microsoft.com/en-us/sql-server/sql-server-downloads) Express edition or better