When building classes I thought if I just added an enum to the parameter list it would pop up the list of the enums, sort of like intellisence.. But I clearly am missing something..

public enum eFullWeekDays
        {
            Sunday = 1,
            Monday = 2,
            Tuesday = 3,
            Wednesday = 4,
            Thursday = 5,
            Friday = 6,
            Saturday = 7,

        }
 
       public DateTime PrevDayofWeek(DateTime datepassed, eFullWeekDays FullWeekDay,bool subtractWeekIfPassCorrectDay)
        {
:
:
}

Only has the intellisense if I do the following

dteNewDate = GenDates.PrevDayofWeek(testdate, (GeneralDates.eFullWeekDays)intWKDay, boolIFCorrectDay);

or

dteNewDate = GenDates.PrevDayofWeek(testdate, GeneralDates.eFullWeekDays.Thursday, boolIFCorrectDay);

Anyway to get it to pop up the weekday list without the prefix of GeneralDates.efullweekdays????

Recommended Answers

All 5 Replies

What the fuck are you naming your enum type "eFullWeekDays" for and not "FullWeekDays"? Unless you have actual evidence that prefixing your variables with the names of their types increases your productivity, you are just a superstitious nutjob.

Anyway to get it to pop up the weekday list without the prefix of GeneralDates.efullweekdays????

No, because you could also theoretically type in a variable of type GeneralDates.eFullWeekDays.

Just a newbie with an incredible learning curve. C#, asp.net, java, html, Linq, AJAx.... etc etc.. Yes at this point you could call me a nutjob from overload..

Since I name the enum in the library and then have to call it in the calling programs it is just helping my overloaded brain. Rather then guessing if I call it Weekday, FullWeekday, DaysOfTheWeek.etc.. Right now the e... helps me get to the list of enums I created and figure out what I need, and helps me seperate them from the long list of objects and properties in the library..

Sorry if my code is offensive, but right now the need is to learn and accomplish.. Quickly...

Sorry, I was just being a jerk :)

You will have to write the name of the enum's type in order to trigger autocomplete; that's life.

There is a System.DayOfWeek enumeration.
There is a DateTime structure with a property DayOfWeek which returns this enumeration.
So why would you feel the need to make your own?
.Net is HUGE, perhaps you did not know it existed?
Join the club, I had the same experience already...

ddanbe beat me to it. I'd go with the System.DayOfWeek, however to answer the general enum question, you would only need the GeneralDates if the eFullWeekDays enum instance is outside the scope of your class or namespace.

Example:

namespace TestA
{
    public class Class1
    {
        public enum Values
        {
            Val1,
            Val2,
            Val3
        }
    }
}
namespace TestB
{
    public class Class2
    {
        public Class2()
        {
            // have to use namespace and class path
            TestA.Class1.Values.Val1;
        }
    }
}

If you bring it out one level, then you have:

namespace TestA
{
    public enum Values
    {
        Val1,
        Val2,
        Val3
    }
    public class Class1
    {

    }
}
namespace TestB
{
    public class Class2
    {
        public Class2()
        {
            // have to use namespace path
            TestA.Values.Val2;
        }
    }
}

Or if it's in the same namespace:

namespace TestA
{
    public enum Values
    {
        Val1,
        Val2,
        Val3
    }
    public class Class1
    {

    }
    public class Class2
    {
        public Class2()
        {
            // same namespace, nothing but enum is needed
            Values.Val3;
        }
    }
}

Intellisense works in all scenarios....

-Nelis

commented: Clear explanation, well done. +4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.