I have a Utils unit in my app which, as of right now, only has a few enums defined, such as:
public enum MostFavoredStates
{
California,
NorthCarolina,
Vermont,
NewMexico
}
public enum LeastFavoredStates
{
NorthDakota,
Illinois,
Nebraska
}
public enum StatesInWhichIHaveResided
{
California,
NewYork,
Montana,
Alaska,
Oklahoma,
Wisconsin,
Idaho,
Missouri
}
When I run ReSharper on my project, it says I need no "using" statements at all in this class; so, I remove them all, and voila! it really does need nothing at all.
"enum" must be declared somewhere - how can it live without a reference to that assembly or namespace? If there's something "baked in" to every class, what is it?
"enum" must be declared somewhere - how can it live without a reference to that assembly or namespace? If there's something "baked in" to every class, what is it?
"enum" is a C# language keyword. It is not a framework type that needs to be resolved, as it's part of the language itself.
Note that there are many other language keywords that are this way. For example, you can use int without a using clause for using System;, as it's "baked into" the language as an alias to System.Int32 - but you can't use Int32, since that is System.Int32.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With