- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
But... we already check that we have inputs in the Frist case, so the check for inputs in the second case is completely superfluous. this.serverConfig will never be set.
Admin
That's the point. When they added the mixedConfig stuff, they didn't remove the obsolete serverConfig code, so it's vestigial.
Admin
Also, the
inputs
andoutputs
variables are just thrown away, looks like? So seems like none of that processing actually matters, unless it has other hidden side-effects.Admin
YEah but what if the status of "inputs" changes by the time you get to the "else". What then, huh?
Admin
var configuration = new ConfigurationBuilder().AddJsonFile("blahblah.json"); // done
Admin
@Sniffnoy ref:
It's always hard to know in these examples what's been snipped out. But overall I suspect that those too are vestiges, probably from before the whole thing was converted from some homebrew config system to a JSON-based
JObject
.Admin
Technically JObject is not even part of the framework; it's part of the Newtonsoft library. In modern .net you only use the System.Text.Json JsonSerializer and that's it. The reason for that is pretty simple and it comes down to two words: Code Generators ;-)