Enums and Interfaces

  • Thread starter Thread starter Matt Parker
  • Start date Start date
M

Matt Parker

Hi

I was wondering if anyone could help me with this problem.

I have an Interface with one method that passes an Enum as a
parameter. I want the enum to be defined in the class that implements
the interface e.g.

public interface IMessaging
{
public static string Create(MessageTypeEnum message);
}

public class ComposerA
{
public enum MessageTypeEnum
{
AppointmentReminder
}
}

public class ComposerB
{
public enum MessageTypeEnum
{
BirthdayReminder
}
}

I need this to be implemented as an Interface, because it's going to
be called from a legacy COM component too.

Any ideas?

Kind regards

Matt Parker

If anyone can hjelp
 
Matt,
I have an Interface with one method that passes an Enum as a
parameter. I want the enum to be defined in the class that implements
the interface e.g.

You can't do that. Perhaps you could change the parameter type to an
int, and then in each Create implementation check if the value is one
of the ones allowed.



Mattias
 
Back
Top