- Home /
Implicit `using static` - where to declare it?
Hello. I have a utility class and I'm using it in 99% of the code. I want to get rid of using static Utility.Extensions
in every file.
I tried going to project properties in MSVS for a possible option but they're not available.
Answer by Bonfire-Boy · Feb 01, 2018 at 11:49 AM
I'm pretty sure that you can't do this (unlike, for example, in Visual Basic where the equivalent thing is possible).
See for example, this 2015 proposal for such a feature: https://github.com/dotnet/roslyn/issues/2044
The responses in that link include reasons why it wouldn't and shouldn't be done.
Note also that even if you could find options in VS or Monodevelop that enabled it, that wouldn't in itself enable Unity to compile your code.
Thanks for the informative answer. On a side note I'm starting to think C# employs a user interdiction philosophy judging from so many requested/inquired features denied in GitHub, StackOverflow, etc. for years, with strong arguments. Overall, "giving people choice and let them decide for their own" is what would and should be done (quote from that link).
I think that a more c++-like free-for-all language philosophy would make it quite hard for it to be used in things like Unity.
Your answer
Follow this Question
Related Questions
UI problem with mask 1 Answer
Unable to Reference a Class 1 Answer
About to start an Ambitious project 2 Answers
Help with auto moving script 1 Answer
C#scripts visibility at runtime and in editor in Monodevelop 1 Answer