473,386 Members | 1,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

interface and enum

I need a intereface so that i get the same structure in several arrays that
i create. I think that i need to use enum in a interface. Abstract classes
don't do the job as i need to inherit from several interfaces.
This doesn't Work.
Any ideas?

using System;
namespace well_test
{
public interface IMeassurement
{
public enum index
{
Timestamp, //= 0;
WellNo, //= 1;
WellTHP, //= 2;
WellTHT, //= 3;
WellBHP, //= 4;
WellBHT, //= 5;
SepPressure, //= 6;
SepTemp, //= 7;
SepOilLev, //= 8;
SepWaterlev, //= 9;
SepGasFlow, //= 10;
SepOilFlow, //= 11;
SepWaterFlow, //= 12;
SepOilDensity, //= 13;
WellChokePos, //= 14;
EntryStatus //= 15;
};
...........
......

Torben
Nov 15 '05 #1
1 16620
You define the enum outside the interface, but compile it in the same
assembly (project). Then you can declare a property member of your
interface as having that enum's type:

// this might not compile as-is but you get the picture
public enum Values
{
One,Two,Three
}

public interface IFace
{
Values { get;set}
}

--
Veuillez m'excuser, mon Français est très pauvre. Cependant, si vous voyez
mauvais C #, c'est mon défaut!
"Torben Madsen" <as*****@privat.dk> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I need a intereface so that i get the same structure in several arrays that i create. I think that i need to use enum in a interface. Abstract classes
don't do the job as i need to inherit from several interfaces.
This doesn't Work.
Any ideas?

using System;
namespace well_test
{
public interface IMeassurement
{
public enum index
{
Timestamp, //= 0;
WellNo, //= 1;
WellTHP, //= 2;
WellTHT, //= 3;
WellBHP, //= 4;
WellBHT, //= 5;
SepPressure, //= 6;
SepTemp, //= 7;
SepOilLev, //= 8;
SepWaterlev, //= 9;
SepGasFlow, //= 10;
SepOilFlow, //= 11;
SepWaterFlow, //= 12;
SepOilDensity, //= 13;
WellChokePos, //= 14;
EntryStatus //= 15;
};
..........
.....

Torben

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: SpaceCowboy | last post by:
I recently got into a discussion with a co-worker about using enums across a dll interface. He wanted to use chars instead, argueing that depending on compiler settings the size of an enum could...
2
by: David | last post by:
hello... how can i use IActiveDesktop COM interface from shell32.dll? thanx...
2
by: matthew_glen_evans | last post by:
Hi there, Quick one about interfaces in c#. It seems that it is illegal to declare types within an interface. I was quite used to doing this in VB.net where the interface can define a...
18
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I have created an enum list like this: enum myEnum : int { This = 2, That, NewVal = 10, LastItm
0
by: zheng | last post by:
I create a OCX program with ATL project, and One parameter in the interface function is ENUM type, and I has defined the ENUM type in the interface, but compiled falid with MIDL2001, in the...
2
by: Cristiano de Pádua Milagres Oliveira | last post by:
What do I to declare the header of a Property in an Interface, and should this property return a generic Enum? Example: public interface IMetric { Enum Unit { get;} } public class...
3
by: Andrew Bainbridge | last post by:
Hi, I'm converting some code over from vb.net to c# and have the following issue. In VB you can have enum's within an interface. i.e. Public Interface Class1 Enum ColorType Black Red
13
by: Bob | last post by:
Hi, Can someone explain why you can't declare enums in an interface? The compiler says "interfaces can't declare types" Ignoring the syntax implications it seems to me that you should be able to...
3
by: hufaunder | last post by:
Imagine you have a charting library that can draw lines, bars, floating bars, bands, etc. Lines and bars need only one input. Floating bars and bands need two inputs. There are two approaches: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.