forcing set list in parameter list prompts?

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Mar 2008
Posts: 10
Reputation: wendas is an unknown quantity at this point 
Solved Threads: 0
wendas wendas is offline Offline
Newbie Poster

forcing set list in parameter list prompts?

 
0
  #1
Jan 22nd, 2009
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..

  1. public enum eFullWeekDays
  2. {
  3. Sunday = 1,
  4. Monday = 2,
  5. Tuesday = 3,
  6. Wednesday = 4,
  7. Thursday = 5,
  8. Friday = 6,
  9. Saturday = 7,
  10.  
  11. }
  12.  
  13. public DateTime PrevDayofWeek(DateTime datepassed, eFullWeekDays FullWeekDay,bool subtractWeekIfPassCorrectDay)
  14. {
  15. :
  16. :
  17. }

Only has the intellisense if I do the following

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

Anyway to get it to pop up the weekday list without the prefix of GeneralDates.efullweekdays????
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,055
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: forcing set list in parameter list prompts?

 
1
  #2
Jan 22nd, 2009
What the **** 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.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 10
Reputation: wendas is an unknown quantity at this point 
Solved Threads: 0
wendas wendas is offline Offline
Newbie Poster

Re: forcing set list in parameter list prompts?

 
0
  #3
Jan 22nd, 2009
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...
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 2,055
Reputation: Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice Rashakil Fol is just really nice 
Solved Threads: 139
Team Colleague
Rashakil Fol's Avatar
Rashakil Fol Rashakil Fol is offline Offline
Super Senior Demiposter

Re: forcing set list in parameter list prompts?

 
1
  #4
Jan 22nd, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 2,046
Reputation: ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of ddanbe has much to be proud of 
Solved Threads: 309
ddanbe's Avatar
ddanbe ddanbe is offline Offline
Postaholic

Re: forcing set list in parameter list prompts?

 
0
  #5
Jan 23rd, 2009
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...
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 21
Reputation: nelis is an unknown quantity at this point 
Solved Threads: 7
nelis nelis is offline Offline
Newbie Poster

Re: forcing set list in parameter list prompts?

 
1
  #6
Jan 23rd, 2009
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:
  1. namespace TestA
  2. {
  3. public class Class1
  4. {
  5. public enum Values
  6. {
  7. Val1,
  8. Val2,
  9. Val3
  10. }
  11. }
  12. }
  13. namespace TestB
  14. {
  15. public class Class2
  16. {
  17. public Class2()
  18. {
  19. // have to use namespace and class path
  20. TestA.Class1.Values.Val1;
  21. }
  22. }
  23. }
If you bring it out one level, then you have:
  1. namespace TestA
  2. {
  3. public enum Values
  4. {
  5. Val1,
  6. Val2,
  7. Val3
  8. }
  9. public class Class1
  10. {
  11.  
  12. }
  13. }
  14. namespace TestB
  15. {
  16. public class Class2
  17. {
  18. public Class2()
  19. {
  20. // have to use namespace path
  21. TestA.Values.Val2;
  22. }
  23. }
  24. }
Or if it's in the same namespace:
  1. namespace TestA
  2. {
  3. public enum Values
  4. {
  5. Val1,
  6. Val2,
  7. Val3
  8. }
  9. public class Class1
  10. {
  11.  
  12. }
  13. public class Class2
  14. {
  15. public Class2()
  16. {
  17. // same namespace, nothing but enum is needed
  18. Values.Val3;
  19. }
  20. }
  21. }
Intellisense works in all scenarios....

-Nelis
Last edited by nelis; Jan 23rd, 2009 at 1:01 pm.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the C# Forum


Views: 653 | Replies: 5
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC