❔ How does the main method work?
I've only ever used c# in unity, so i've never worked outside the context of making games, so using the main method is very new to me. Since the main method needs to be static anything i use in it requires being static. How do you navigate around this?
6 Replies
is generally the simplest way to get out of the static context your code starts in
it's certainly what I do, with the new top level statement you can also do
then
Since the main method needs to be static anything i use in it requires being static.you can still create instances of types and call their non-static methods
Awesome, thanks guys
in addition to what the generic host does, there is also ConsoleAppFramework which adds some argument parsing the execute commands (similar to controllers in asp.net mvc) https://github.com/Cysharp/ConsoleAppFramework
GitHub
GitHub - Cysharp/ConsoleAppFramework: Micro-framework for console a...
Micro-framework for console applications to building CLI tools/Daemon/Batch for .NET, C#. - GitHub - Cysharp/ConsoleAppFramework: Micro-framework for console applications to building CLI tools/Daem...
large scale apps generally end up looking something like this...
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.
Was this issue resolved? If so, run /close
- otherwise I will mark this as stale and this post will be archived until there is new activity.