3 ms·
> Then with static using directives, you don't need to spell out the namespaces. Static using directives! Certainly a useful tool, thank you. I had been away f
by jeswin 7y ago
> Then with static using directives, you don't need to spell out the namespaces.
Static using directives! Certainly a useful tool, thank you. I had been away from the .Net universe for a while and I think I have some more catching up to do. Some of the newer changes in C# help a lot with reducing code heft, even though it makes the language more complex.
However, the Framework seems to be headed in the opposite direction when it comes to simplicity. Here's for example the IOptions pattern: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options https://docs.microsoft.com/en-us/aspnet/core/fundamentals/co...
- thomasz 7y agoThe asp configuration thing is complicated but powerful. If you don't want that, you can just use ``Environment.GetEnvironmentVariable`` and be done with it.
- shhsshs 7y agoPlus it’s barely any extra work to load settings from environment variables. And it lets you write code agnostic to where the settings are coming from, and then choose to load them from environment variables, a file, hard coded values, etc. Makes testing easier too because you don’t have to write a fixture around your settings. Just build the class with known setting values without writing code purely for testing.
- noderat 7y agoI really wish the documentation for things like DI, IOptions and ILogger were moved out of the ASP.NET documentation. Trying to decipher from the documentation how to use these in a non-ASP.NET project is needlessly complicated.
- WorldMaker 7y agoIt's getting pushed out of ASP.NET with the "Generic Host" efforts. It's still for the time being in ASP.NET documentation, but you see it's moving in that direction. https://laurentkempe.com/2019/09/03/WPF-and-dotnet-Generic-Host-with-dotnet-Core-3-0/ https://laurentkempe.com/2019/09/03/WPF-and-dotnet-Generic-H... https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/generic-host?view=aspnetcore-3.0 https://docs.microsoft.com/en-us/aspnet/core/fundamentals/ho...