One of the things I’m always working on and am always excited about is making C# simpler for new folks. With .NET 5, today, this works, as it includes C# 9 > dotnet new console That’s C# 9 top level programs. We should be able to remove even more. Skip the first command completely and do it all on one line, one file. A hello world is either using System; or System.Console.WriteLine("Hello World!"); or, scandalously using System; Not sure how I feel about that last one. Regardless…would this work in Visual Studio 2019? What if I was teaching a class and wanted to have one file per homework assignment, for example? Right now Visual Studio only supports one top-level program per project. Make sense why, but for learning, why not allow folks to choose from the run/debug menu? I’m going to add a reference to SmallSharp like this (or in Visual Studio) > dotnet add package smallsharp Now here’s what my homework looks like in Visual Studio 2019! There’s one menu item per top level program! This lovely prototype was done by Daniel Cazzulino (kzu) and you can learn more at https://github.com/devlooped/SmallSharp, or just try it out as I have here! What do you think? How can small top-level programs help new people? What about this? > dotnet new microservice Sound off in the comments. How tight and simple would that be? Sponsor: Tired of not finding the code you’re looking for? Get Sourcegraph universal code search and search code across ALL your repos, languages, and code hosts. Find and fix code fast with Sourcegraph. Try it now! © 2020 Scott Hanselman. All rights reserved. Tiny top-level programs with C# 9 and SmallSharp and Visual Studio published first on http://7elementswd.tumblr.com/ via Tumblr Tiny top-level programs with C# 9 and SmallSharp and Visual Studio
0 Comments
Leave a Reply. |
About UsIf you want to keep up with the latest in web design, you have to be willing to study and learn on an ongoing basis. If you are a web developer or web designer, you’ll find a lot of useful tutorials and code snippets collection here. Furthermore, we also discuss more general topics of web design and how the role of a web designer has evolved over the years.
|