Click here to Skip to main content
15,918,742 members
Home / Discussions / C#
   

C#

 
QuestionHow to get enum as parameter thru interface Pin
MichCl6-Dec-12 4:00
MichCl6-Dec-12 4:00 
I have an enum definition that I wanted to put in my interface, but I'm getting a compilation error:
Mode: interfaces cannot declare types

C#
public enum Mode
        {
            Off = 0,
            On1 = 1,
            On2 = 2
        }

and the interface has a method in it that classes implementing it must define, where I want to pass the mode as a param:
C#
int ProcessTWrit(ref Byte[] wDat, ref Byte[] sDat, ref Byte[] dataCk, int theMode);


So, I had to put separate definitions of the enum in both my El.cs and the class that it's calling through the interface.

I have my El.cs that I have also defined the enum above and want to call the above method:

C#
result = cr.ProcessTWrit(ref wDat, ref sDat, ref dataCk, (int)Mode.On1);


My question is, is there a way that I can put my Mode enum in the interface so that the calling class and the receiving class can pass/use the enum values, so I don't have to have multiple definitions of the enum? There doesn't seem to be any other class that it would make sense for me to put the Mode definition in. This is a factory implementation. It looks like this:

El.cs =======> iCR.cs ==========================> CR5.cs
..........calls................ ProcessTWrit()................................................................ ProcessTWrit(){}

with multiple definitions of Mode in El.cs and CR5.cs. The three classes discussed above are in separate Visual Studio projects, if it makes a difference.
AnswerRe: How to get enum as parameter thru interface Pin
DaveyM696-Dec-12 4:08
professionalDaveyM696-Dec-12 4:08 
AnswerRe: How to get enum as parameter thru interface Pin
PIEBALDconsult6-Dec-12 4:55
mvePIEBALDconsult6-Dec-12 4:55 
QuestionWhat would be the best approach for screen sharing c# Pin
Tridip Bhattacharjee5-Dec-12 21:00
professionalTridip Bhattacharjee5-Dec-12 21:00 
AnswerRe: What would be the best approach for screen sharing c# Pin
Eddy Vluggen6-Dec-12 5:28
professionalEddy Vluggen6-Dec-12 5:28 
GeneralRe: What would be the best approach for screen sharing c# Pin
Tridip Bhattacharjee6-Dec-12 19:54
professionalTridip Bhattacharjee6-Dec-12 19:54 
GeneralRe: What would be the best approach for screen sharing c# Pin
Eddy Vluggen7-Dec-12 1:20
professionalEddy Vluggen7-Dec-12 1:20 
QuestionExtending OpenFileDialog to select folder and file simultaneously Pin
hemant.4oct5-Dec-12 19:57
hemant.4oct5-Dec-12 19:57 
AnswerRe: Extending OpenFileDialog to select folder and file simultaneously Pin
Richard MacCutchan5-Dec-12 21:41
mveRichard MacCutchan5-Dec-12 21:41 
GeneralRe: Extending OpenFileDialog to select folder and file simultaneously Pin
hemant.4oct5-Dec-12 22:16
hemant.4oct5-Dec-12 22:16 
GeneralRe: Extending OpenFileDialog to select folder and file simultaneously Pin
Eddy Vluggen6-Dec-12 2:28
professionalEddy Vluggen6-Dec-12 2:28 
GeneralRe: Extending OpenFileDialog to select folder and file simultaneously Pin
Richard MacCutchan6-Dec-12 2:45
mveRichard MacCutchan6-Dec-12 2:45 
Questionimage processing Pin
Bishwajit Nepali5-Dec-12 19:52
Bishwajit Nepali5-Dec-12 19:52 
AnswerRe: image processing Pin
Richard MacCutchan5-Dec-12 21:34
mveRichard MacCutchan5-Dec-12 21:34 
AnswerRe: image processing Pin
lukeer5-Dec-12 23:45
lukeer5-Dec-12 23:45 
QuestionHow to read data from crl file in C# Pin
Gramulos5-Dec-12 19:12
Gramulos5-Dec-12 19:12 
AnswerRe: How to read data from crl file in C# Pin
Richard MacCutchan5-Dec-12 21:32
mveRichard MacCutchan5-Dec-12 21:32 
AnswerRe: How to read data from crl file in C# Pin
Eddy Vluggen6-Dec-12 2:34
professionalEddy Vluggen6-Dec-12 2:34 
QuestionMultiThreading Pin
MAW305-Dec-12 17:49
MAW305-Dec-12 17:49 
AnswerRe: MultiThreading Pin
Dave Kreskowiak5-Dec-12 18:28
mveDave Kreskowiak5-Dec-12 18:28 
GeneralRe: MultiThreading Pin
MAW305-Dec-12 18:40
MAW305-Dec-12 18:40 
GeneralRe: MultiThreading Pin
Dave Kreskowiak6-Dec-12 1:45
mveDave Kreskowiak6-Dec-12 1:45 
Questionimage processing Pin
Bishwajit Nepali5-Dec-12 17:37
Bishwajit Nepali5-Dec-12 17:37 
AnswerRe: image processing Pin
Dave Kreskowiak5-Dec-12 18:17
mveDave Kreskowiak5-Dec-12 18:17 
AnswerRe: image processing Pin
Mycroft Holmes5-Dec-12 18:35
professionalMycroft Holmes5-Dec-12 18:35 

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.