Click here to Skip to main content
15,893,487 members
Home / Discussions / C#
   

C#

 
Generalstring foreach row's column Pin
lornej10-Mar-05 11:05
lornej10-Mar-05 11:05 
GeneralRe: string foreach row's column Pin
Colin Angus Mackay10-Mar-05 11:30
Colin Angus Mackay10-Mar-05 11:30 
GeneralRe: string foreach row's column Pin
J4amieC10-Mar-05 22:14
J4amieC10-Mar-05 22:14 
General.NET remoting and Simple Client / Server application design help... Pin
Kasdoffe10-Mar-05 10:50
Kasdoffe10-Mar-05 10:50 
GeneralRe: .NET remoting and Simple Client / Server application design help... Pin
Kasdoffe11-Mar-05 3:30
Kasdoffe11-Mar-05 3:30 
GeneralAsync Programming and Thread-safe Delegates Pin
BnWasteland10-Mar-05 9:29
BnWasteland10-Mar-05 9:29 
GeneralRe: Async Programming and Thread-safe Delegates Pin
TylerBrinks10-Mar-05 11:43
TylerBrinks10-Mar-05 11:43 
Generalnew Enum Pin
Dean Goodman10-Mar-05 8:57
Dean Goodman10-Mar-05 8:57 
I'm looking for a way to do the following:

class BaseClass
{
  public enum Action
  {
    NO_ACTION
  }

  protected virtual bool ValidateAction(Action a)
  {
   return true;
  }
}

class DerivedClass : BaseClass
{
  public new enum Action
  {
    ACTION1,
    ACTION2
  }

  protected override bool ValidateAction(Action a)
  {
    //... validate Action ...
  }
}


The above doesn't work because by declaring my enum Action as new in the derived class I've created a totally new type; thus the compiler complains that I shouldn't be trying to override ValidateAction in DerivedClass.

Basically I want to avoid having to use protected bool ValidateAction(int) as my function prototype, thereby avoiding having to cast my enum values to ints all the time to make the call to ValidateAction. Also, this would allow me to call ValidateAction from BaseClass and be sure that my virtual method in DerivedClass gets called.

Is there an obvious way of doing this that I am missing? Deriving from System.Enum to create an Action base class would do the trick, but I've read somewhere that this is poor practice. Any other suggestions?
GeneralRe: new Enum Pin
TylerBrinks10-Mar-05 11:32
TylerBrinks10-Mar-05 11:32 
GeneralGlobal Mouse Hook for XButtons Pin
AnzelVincir10-Mar-05 8:40
AnzelVincir10-Mar-05 8:40 
Generalnew issue - compare data Table Column Pin
lornej10-Mar-05 8:20
lornej10-Mar-05 8:20 
GeneralRe: new issue - compare data Table Column Pin
TylerBrinks10-Mar-05 8:34
TylerBrinks10-Mar-05 8:34 
GeneralRe: new issue - compare data Table Column Pin
lornej10-Mar-05 9:34
lornej10-Mar-05 9:34 
Generalproblem whit date Help Me Pin
kings_110-Mar-05 8:06
kings_110-Mar-05 8:06 
GeneralRe: problem whit date Help Me Pin
TylerBrinks10-Mar-05 8:33
TylerBrinks10-Mar-05 8:33 
GeneralRe: problem whit date Help Me Pin
kings_110-Mar-05 11:15
kings_110-Mar-05 11:15 
GeneralRe: problem whit date Help Me Pin
TylerBrinks10-Mar-05 11:21
TylerBrinks10-Mar-05 11:21 
GeneralRe: problem whit date Help Me Pin
kings_111-Mar-05 7:24
kings_111-Mar-05 7:24 
GeneralCleaning a Place Holder from a class Pin
see0710-Mar-05 6:48
see0710-Mar-05 6:48 
GeneralRe: Cleaning a Place Holder from a class Pin
see0711-Mar-05 11:41
see0711-Mar-05 11:41 
GeneralRe: Cleaning a Place Holder from a class Pin
see0714-Mar-05 5:19
see0714-Mar-05 5:19 
GeneralUse C# for Addin in Excel Pin
Fardoche610-Mar-05 6:37
Fardoche610-Mar-05 6:37 
GeneralRe: Use C# for Addin in Excel Pin
Skynyrd10-Mar-05 6:55
Skynyrd10-Mar-05 6:55 
Generalsmall project on c# Pin
dipesh patel10-Mar-05 6:36
dipesh patel10-Mar-05 6:36 
GeneralRe: small project on c# Pin
Judah Gabriel Himango10-Mar-05 6:59
sponsorJudah Gabriel Himango10-Mar-05 6:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.